New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sabil-js

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sabil-js

Sabil JS SDK

  • 2.4.2
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Sabil JavaScript SDK

This is the official Sabil API client for JavaScript.

  • Documentation

Installation

yarn add sabil-js

or if using npm

npm install --save sabil-js

Import

import Sabil from "sabil-js";

Note the common js version can be found in sabil-js/common.cjs

Usage

  • Cal the attach function to attach the device to the user. You must pass the client_id and a user.
try {
  const { device_id } = await Sabil.attach({
    client_id: `client_id`,
    user: `user_id`,
    appearance_config: {
      font_family: `Inter, sans-serif`,
    },
  });
} catch (error) {
  console.error(error);
}

Ideally, you should call the attach function on every page as soon as you have the user id available. Alternatively, you can call it only when the user id becomes available and/or on key entry pages like the dashboard, login, ...etc.

  • Detaching a user device

By default, the devices are automatically detached if they are not used for 1 week. You can change this behavior in the dashboard settings. But it might be useful to manually detach the devices sometimes. For example, if the user logs out, it's good to detach the device. If you need to manually detach the device, do the following:

try {
  await Sabil.detach({
    client_id: `client_id`,
    user: `user_id`,
    device: `device_id`,
  });
} catch (error) {
  console.error(error);
}

The device field takes the device ID that is returned in the attach function response as device_id.

That's it. To learn more, visit the documentation

Keywords

FAQs

Package last updated on 12 Oct 2022

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