Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gigya-api-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gigya-api-wrapper

A simple Gigya JS api wrapper which works with promises.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
increased by766.67%
Maintainers
1
Weekly downloads
 
Created
Source

Gigya API wrapper

This is a simple Gigya JS api wrapper which works with promises and should make life easier for developers working with Gigya markup extensions.

Scope

Currently this library does not include the custom JS registration, login and password reset API functions as it is intended to be used next to the Gigya markup extensions. The Gigya Markup extensions deal with the registration, account linking, password reset and other flows on their own as long as you add the proper data and class attributes on their HTML.

A later release might possibly contain the other API functions so you can code a completely custom Gigya RaaS implementation.

How to use...

  npm i gigya-api-wrapper

Initialisation

import GigyaWrapper from 'gigyaWrapper';

this.gigyaWrapperInstance = new GigyaWrapper({
  apiKey: '<api_key>',
  containerID: 'wrapper',
  screenSet: 'screen-set', // could be on gigya's servers or local
  lang: 'en',
  autoLogin: true,
  debug: false,
  https: true
});

// Listen to the async load event of the Gigya library.
this.gigyaWrapperInstance.onLibraryReady().then( ( gigyaObject )=>{
  // do stuffs
});

A common use case

Initialise like the above code sample.

// Listen to user events
this.gigyaWrapperInstance.registerEventListeners({
  onLogin: ()=>{ /* show profile */ },
  onLogout: ()=>{
    //shortcut for the showScreenSet function.
    this.gigyaWrapperInstance.showLoginScreen();
  }
});

this.gigyaWrapperInstance.checkLoggedInStatus().then( ( response )=>{
    if( response.loggedIn ){
      // show profile
    }
    else {
      this.gigyaWrapperInstance.showLoginScreen();
    }
  }
});

Other common functions

Remember to always initialise (onLibraryReady()) first so the Gigya object is available.


// Return promises
this.gigyaWrapperInstance.getAccountInfo();
this.gigyaWrapperInstance.logout();
this.gigyaWrapperInstance.getSchema();
this.gigyaWrapperInstance.getPolicies();
this.gigyaWrapperInstance.getScreenSets();

// ScreenSet handling
// See esdoc directory for all property explanations
this.gigyaWrapperInstance.showLoginScreen();

this.gigyaWrapperInstance.showScreenSet({
  screenSet: 'screen-set',
  containerID: 'wrapper',
  startScreen: 'gigya-login-screen'
});

this.gigyaWrapperInstance.hideScreenSet({
  screenSet: 'screen-set',
  containerID: 'wrapper'
});

// Sharing
// See esdoc directory for all property explanations
this.gigyaWrapperInstance.share({
  provider: 'facebook',
  url: 'http://timbenniks.nl',
  title: 'Tims website',
  subtitle: 'Times website subtitle',
  description: 'Tims website is pretty cool man',
  imageurl: 'http://timbenniks.nl/assets/favicon.png'
});

Development

You need to have node and npm installed to be able to work on this code. If you intend to add or change code you will need to re-render the esdoc.

Install esdoc

npm install -g esdoc

Run esdoc

esdoc -c esdoc.json

Installation

npm install

Tests

npm run test

Dev

npm run dev

Build

npm run build

Keywords

FAQs

Package last updated on 15 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc