🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@cogsworthdev/embed-sdk-js

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cogsworthdev/embed-sdk-js

A client side SDK for integrating Cogsworth's Embed Widget

1.0.2
latest
Source
npm
Version published
Weekly downloads
8
100%
Maintainers
2
Weekly downloads
 
Created
Source

Cogsworth Embed App Client SDK

The Cogsworth Embed App SDK allows Cogsworth partners to embed the Cogsworth Embed application in their own sites with minimal configuration.

Installation

npm install @cogsworthdev/embed-sdk-js
# or
yarn add @cogsworthdev/embed-sdk-js

Usage

One you have set up your secure payload endpoint in your backend, the client SDK can consume it and render the Cogsworth embed application in your site.

In addition to the payload endpoint, you'll need to provide a query selector for the element you wish to render the application in, and your partner ID.

const client = new CogsworthClient({
  partnerId: 'xxxxxxxxx',
  payloadEndpoint: {
    url: `http://partner.com/api/cogsworth-payload?userId=${userId}&clinicId=${clinicId}`,
    // Headers can be used to authenticate the request to the payload endpoint
    headers: {},
  }
  containerSelector: '#cogsworth-widget',
})

Once instantiated, you can call the init() method to render the Cogsworth embed application.

client.init()

Full example (React)

import CogsworthClient from '@cogsworth4/embed-sdk-js'

const App = () => {
  useEffect(() => {
    // 1. Instantiate the Cogsworth Client by indicating your partner ID, the payload endpoint url and optional headers.
    const client = new CogsworthClient({
      partnerId: 'xxxxxxxxx',
      payloadEndpoint: {
        url: `http://partner.com/api/cogsworth-payload?userId=${userId}&clinicId=${clinicId}`,
        headers: {},
      },
      containerSelector: '#cogsworth-widget',
    })

    // 2. Initialize the cogsworth embed application
    client.init()
  }, [])

  return <div id='cogsworth-widget' />
}

Keywords

cogsworth

FAQs

Package last updated on 07 Apr 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