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

@dopt/blocks-javascript-client

Package Overview
Dependencies
Maintainers
6
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dopt/blocks-javascript-client

A generated JavaScript API client for Dopt's blocks API

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by75%
Maintainers
6
Weekly downloads
 
Created
Source

Dopt blocks JavaScript client

Overview

The Dopt blocks JavaScript client is a friendly server-side and client-side package for accessing the Dopt blocks API to get and mutate block and flow state for a particular user in Dopt.

The client lives in our open-source monorepo odopt.

It is published to npm as @dopt/blocks-javascript-client.

Installation

Via npm:

npm install @dopt/blocks-javascript-client

Via Yarn:

yarn add @dopt/blocks-javascript-client

Via pnpm:

pnpm add @dopt/blocks-javascript-client

Configuration

To configure the blocks JavaScript client you will need

  1. A blocks API key (generated in Dopt)
  2. A block uid

Usage

Initialization

import { Configuration, BlocksApi } from "@dopt/blocks-javascript-client";

const doptBlocksClient = new BlocksApi(
  new Configuration({
    apiKey: "BLOCKS_API_KEY",
  })
);

Blocks

Get block data using the findBlocks method:

const version = 3;
const userId = "example-user-idenitifer";
const uid = "xqC0wpZgoaYXbAPk8W0sk";

doptBlocksClient.findBlocks(
  version,
  userId,
  uid
);

Transition a block using the blockTransitions method:

const transitions = new Set(['complete']);
const version = 3;
const userId = "example-user-identifier";
const uid = "xqC0wpZgoaYXbAPk8W0sk";

doptBlocksClient.blockTransitions(
  transitions,
  version,
  userId,
  uid
);

Flows

Get flow data using the getFlow method:

const version = 3;
const userId = "example-user-identifier";
const sid = "example-flow-identifier";

doptBlocksClient.getFlow(
  version,
  userId,
  sid
);

Transition a flow using the flowIntent method:

const version = 3;
const userId = "example-user-identifier";
const sid = "example-flow-identifier";
const intent = "finish";

doptBlocksClient.flowIntent(
  version,
  userId,
  sid,
  intent
);

FAQs

Package last updated on 17 Apr 2023

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