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

@highnoteplatform/risk-application

v1.0.5

Published

Risk application SDK for early detection of fraud.

Downloads

9

Readme

@highnoteplatform/risk-application

Note: This library is in a pre-release phase. Prior to the release of version 1.0.0, breaking changes may be introduced.

The Highnote Risk Application SDK allows you to enable risk intelligence to your account holder applications.

Usage

Risk Application SDK Documentation

Note: Read the full documentation here.

Installation

With npm:

npm i @highnoteplatform/risk-application

With yarn:

yarn add @highnoteplatform/risk-application

Generate a Risk Application SDK Session token

On your server, generate a risk application sdk session token using the GraphQL API.

See the generateRiskApplicationSDKSessionToken docs.

GraphQL query

mutation generateRiskApplicationSdkSessionToken {
  generateRiskApplicationSDKSessionToken {
    __typename
    ... on RiskApplicationSDKSessionToken {
      sessionToken
    }
    ... on AccessDeniedError {
      message
    }
    ... on UserError {
      errors {
        path
        code
        description
      }
    }
  }
}

Response

{
  "data": {
    "generateRiskApplicationSDKSessionToken": {
      "sessionToken": "TOKEN"
    }
  },
  "extensions": {
    "requestId": "example-request-id"
  }
}

Prepare your HTML

The Risk Application SDK automatically extract element's name via various DOM attributes like name and id. To ensure smooth integration follow the guidance found here Example html below.

Account Holder Application

You can initialize the Risk Application SDK by calling initializeRiskApplicationSdk. This returns a Promise that contains a reference a clientToken to be used with the create account holder mutations. You can either use the token or invoke the submit function returned by the initializeRiskApplicationSdk function.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Account Holder Application</title>
  </head>
  <body>
    <p>Fill out Account holder application here:</p>
    <div>
      <form autocomplete="on" id="riskApplicationSdkConfig">
        <div>
          <div>
            <label for="firstName">First Name:</label>
            <input name="firstName" type="text" autocomplete="given-name" />
          </div>
          <div>
            <label for="lastName">Last Name:</label>
            <input name="lastName" type="text" autocomplete="family-name" />
          </div>
          <div>
            <label for="line1">Street Address Line 1:</label>
            <input name="line1" type="text" autocomplete="address-line1" />
          </div>
          <div>
            <label for="line2">Street Address Line 2:</label>
            <input name="line2" type="text" autocomplete="address-line2" />
          </div>
          <div>
            <label for="city">City:</label>
            <input name="city" type="text" autocomplete="address-level2" />
          </div>
          <div>
            <label for="state">State:</label>
            <input name="state" type="text" autocomplete="address-level1" />
          </div>
          <div>
            <label for="postal">Postal Code:</label>
            <input name="postal" type="text" autocomplete="postal-code" />
          </div>
          <div>
            <label for="country">Country:</label>
            <input name="country" type="text" autocomplete="country" />
          </div>
          <div>
            <label for="dob">Date of Birth:</label>
            <input type="date" id="dob" autocomplete="bday" />
          </div>
          <div>
            <label for="phone">Phone:</label>
            <input name="phone" type="tel" autocomplete="tel" />
          </div>
          <div>
            <label for="email">Email:</label>
            <input name="email" type="email" autocomplete="email" />
          </div>
        </div>
        <button type="submit"></button>
      </form>
    </div>
  </body>
</html>

Initialize the library

The clientToken outputted by initializeRiskApplicationSdk must be used to submit the account holder application.

import { initializeRiskApplicationSdk } from "@highnoteplatform/risk-application";

function handleRiskApplicationSdkConfigForm(riskSdkReturn: RiskApplicationSdkReturn) {
  return async function handler(event: Event) {
    event.preventDefault();
    // Graphql response
    const graphqlResponse = riskSdkReturn riskSdk.submit();
  };
}


const accountHolderForm = document.querySelector<HTMLElement>(
  "#accountHolderForm"
);

const sdkResponse = await initializeRiskApplicationSdk({
  riskApplicationSdkToken: "token",
  environment: "test",
  form: accountHolderForm,

  onError: (error: RiskApplicationError) => {
    switch (error.name) {
      case "AccessDeniedError":
        // Handle access denied error
        break;
      case "AccountHolderFormMissingRequiredField":
        // Handle account holder form missing required field. Add fields to form,
        // and/or ensure input names match
        break;
      case "RiskApplicationInternalError":
        // Handle initiation issues. Contact Highnote
        break;
      case "USBusinessAccountHolderFormNotSupported":
        // Change form to be person oriented
        break;
      case "UserError":
        // Handle user errors
        break;
      default:
        // Unknown error encountered
        console.log(error);
        break;
    }
  },

  onSuccess: (response: RiskApplicationSdkResponse) => {
    if (response.__typename === "USPersonAccountHolder") {
      alert(`Person created ${response.id}`);
    }
  },
})!;


accountHolderForm.addEventListener(
  "submit",
  handleRiskApplicationSdkConfigForm(sdkResponse)
);