Socket
Socket
Sign inDemoInstall

@ingrain/ingrain-client-js

Package Overview
Dependencies
0
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ingrain/ingrain-client-js

Ingrain (ingrain.dev) client-side SDK


Version published
Weekly downloads
0
Maintainers
2
Install size
55.3 kB
Created
Weekly downloads
 

Readme

Source

Ingrain Client SDK

Ingrain (https://ingrain.dev) SDK for the browser.

Overview

This is the client-side Javascript SDK for Ingrain. Ingrain is a service that makes it easy for you to add user activity logging to your app in minutes.

UI Components Package

Ingrain also provides React UI Components that work out of the box. The components are part of the Ingrain React package.

Getting Started

Installation

npm i @ingrain/ingrain-client-js

or with yarn:

yarn add @ingrain/ingrain-client-js

Usage

import { Ingrain } from '@ingrain/ingrain-client-js';

// Initialize Ingrain
const opts = {
  publishableKey: 'your-publishable-key',
  getUserJwtToken: async () => {
    return "your-user's-jwt-token";
  },
};

const ingrain = new Ingrain(opts);

// Log action
ingrain
  .createUserEvent({
    actorId: 'example-actor-id',
    actorDisplayName: 'example-actor-id',
    actorMetadata: {
      // Can also be null for no metadata
      any: 'any',
      metadata: 'metadata',
      here: 'here',
    },
    entityId: 'example-application',
    entityName: 'Example Application',
    entityDisplayLabel: `Example Application's settings`,
    entityMetadata: null,
    entityPropName: 'Settings', // Can be null
    appUserOrgId: 'example-org-id',
    action: Action.UPDATE,
    oldValue: 'old-settings-value', // can be null
    newValue: 'new-settings-value', // can be null
  })
  .catch((err) => {
    console.error('Error creating user event', err);
  });

// Get data
ingrain
  .readUserEvents({
    actorId: 'example-actor-id',
  })
  .then((resp) => {
    const { data } = resp;

    // Display the data
  });

Documentation

You can start from Introduction or jump straight to Client JS SDK

Keywords

FAQs

Last updated on 29 Feb 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc