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

@oneloop-hq/react

v1.0.14

Published

To get you easily started with providing all functionality around API Key management, we have created a React SDK that you can use in your React application.

Downloads

960

Readme

Oneloop React SDK

To get you easily started with providing all functionality around API Key management, we have created a React SDK that you can use in your React application.

With a single line of code, you can add a component that will handle the entire API Key management process for you.

Get Started

Sign up for Oneloop

Go to Oneloop and get an account for free.

Follow the onboarding steps and make sure to store the following:

  1. Oneloop SDK Token
  2. Oneloop Workspace ID

Backend - Get Link Token

In your backend, set up a POST request to initialize a Oneloop session and get a link_token from Link Token endpoint

Bash

curl 'https://prod.oneloop.ai/api/v1/link-token'
  -H 'authorization: Bearer <your_oneloop_sdk_key>'
  -H 'accept: application/json, text/plain, */*'
  -H 'content-type: application/json'
  --data-raw '{
    "workspaceId":"workspaceId",
    "customerId":"customerId"
  }'

Node

fetch("https://prod.oneloop.ai/api/v1/link-token", {
  method: "POST",
  headers: {
    authorization: "Bearer <your_oneloop_sdk_key>",
    accept: "application/json, text/plain, */*",
    "content-type": "application/json",
  },
  body: {
    workspaceId: "workspaceId",
    customerId: "customerId",
  },
});

Pass in your Production Access API key as a header.

Set up a React application using Vite

Scaffold your new React application using Vite

npm create vite@latest oneloop-react --template react-ts
cd oneloop-react
npm install
npm run dev

Install the React SDK

Oneloop's React SDK gives you access to prebuilt components, hooks, and helpers for React.

To get started using Oneloop with React, add the SDK to your project:

npm install @oneloop-hq/react

Embed Oneloop API Key Manager

Now make the same request in your frontend to get the link_token and initialize the Oneloop session.

Feel free to pass workspaceId and customerId from your frontend. Or you can have them hardcoded in your backend. Your customerId can be any unique representation of your customer in your system

⚠️ Please make sure not to expose your Oneloop SDK key in your frontend code.

import { OneloopApiKeyManager } from "@oneloop-hq/react";
import { useState } from "react";

const WORKSPACE_ID = "<your-oneloop-workspace-id>";
const CURRENT_CUSTOMER_ID = "<your-customer-id>";

export default function Page() {
  const [linkToken, setLinkToken] = useState<string>("ADD_GENERATED_LINK_TOKEN");

  return (
    <div>
      {linkToken &&
        <OneloopApiKeyManager
          accentColor="#ADFF85"
          description="Create a key that unlocks full API access, enabling extensive interaction with your account. Learn more"
          textColor="#000000"
          title="Standard keys"
          token={linkToken}
          darkMode={false}
        />
    </div>
  );
}