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

@cognifit/launcher-js-sdk

v2.3.2

Published

Connect your app with CogniFit

Downloads

456

Readme

CogniFit SDK

Connect your Angular web apps with CogniFit. Launch CogniFit session for your users.


Requirements

  • Contact CogniFit to register your partner and get your credentials.

  • Use the CogniFit API or the CogniFit PHP SDK to register users on CogniFit and to get access tokens.


Installation

  $ npm install @cognifit/launcher-js-sdk

Usage

  • Request a CogniFit user access token

    Use the CogniFit API or the CogniFit PHP SDK to get an active access token for the user.

  • Initialize CogniFit SDK

    import { CognifitSdk } from '@cognifit/launcher-js-sdk';
    import { CognifitSdkConfig } from '@cognifit/launcher-js-sdk/lib/lib/cognifit.sdk.config';
    
    
    containerId: string               // Target container for CogniFitLoading.
    clientId: string;                 // Provided by CogniFit agent.
    cognifitUserAccessToken: string;  // Requested in previous section. 
    sandbok: boolean;                 // Default false. Sandbox needs to be allowed by CogniFit agent.
     
    const cognifitSdkConfig = new CognifitSdkConfig(
      containerId,
      clientId,
      cognifitUserAccessToken,
      {
        sandbox: false,
        appType: 'web',                 // 'web' or 'app'.
        theme: 'light',                 // 'light' or 'dark'.
        showResults: false,
        customCss: '',                  // Url to custom css file.
        screensNotToShow: [],           // List of screens not to show after the session.
        preferredMobileOrientation: '', // '' (empty), 'landscape' or 'portrait'. This applies only on mobile browsers or embedded webviews
        isFullscreenEnabled: true,      // Default true. If false the App will consider that the browser doesn't support fullscreen mode.
        scale: 100,                     // Default 800. Maximum value used to display values.
        listenEvents: true              // Default false. If true, events will be triggered during session life.
      }   
    );
    
    cognifitSdk.init(cognifitSdkConfig).then(response => {
      
    }).catch(error => {
      
    });

    Note about isFullscreenEnabled: if set to false our web App will behave as if the browser does not support fullscreen mode. This means there will not be a button to enter fullscreen mode. Additionally our code will not ask the user to enter fullscreen mode if the browser window is smaller than the recommended window size. The recommended window size is currently 890x600 pixels for desktop, and 568x320 pixels for mobile. A warning will be emitted in the browser's console if the window size goes below these values.

  • Launch session

    typeValue: string;
    keyValue: string;
    
    cognifitSdk.start(
      typeValue, 
      keyValue
    ).subscribe({
        next: (cognifitSdkResponse) => {
          if (cognifitSdkResponse.isSessionCompleted()) {
            cognifitSdkResponse.typeValue;
            cognifitSdkResponse.keyValue;
          }
          if (cognifitSdkResponse.isSessionAborted()) {
            
          }
          if (cognifitSdkResponse.isErrorLogin()) {
    
          }
          if (cognifitSdkResponse.isEvent()) {
            const eventPayloadValues = cognifitSdkResponse.eventPayload.getValues();
          }
        },
        complete: () => {
      		
    	},
        error: (reason) => {
      		
    	}
    });

Errors

  • In initialization

    When calling cognifitSdk.init or cognifitSdk.start some errors could be return. Error can be retreive using:

    • cognifitSdk.cognifitSdkError.getError()
    • cognifitSdk.cognifitSdkError.getMessage()
  • Launching session