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

subs-react

v1.4.49

Published

Use Subs in your website has never been easier! Thanks to our React JS Package.

Downloads

40

Readme

Subs Widget

Use Subs in your website has never been easier! Thanks to our React JS Package.

Installation

First, install the package:

yarn install subs-react

or

npm install subs-react

Usage

Now you just need to import and use our customizable button:

import { Subs } from 'subs-react';

const handleResponse = (response : {success:boolean, message: string}) => {
   console.log("This is what happened" , response);    
}

return(
<Subs address={"0x135B48F76870C2e0d5440dE8F5E7b7A6a7d52720"} 
        appId="40" 
        chain={"mumbai"} 
        color='red'
        width={200}
        defaultPayment='Premium'
        choice={["payment", "token"]}
        dataOnSubs={handleResponse} />
)

How it Works

Just widget without default payment

<Subs address={"0x135B48F76870C2e0d5440dE8F5E7b7A6a7d52720"} 
        appId="40" 
        chain={"mumbai"} 
        dataOnSubs={handleResponse} 
/>

Widget with default payment

<Subs address={"0x135B48F76870C2e0d5440dE8F5E7b7A6a7d52720"} 
        appId="40" 
        chain={"mumbai"} 
        defaultPayment='Premium'
        dataOnSubs={handleResponse} 
/>

Widget with default payment and preselected token

<Subs address={"0x135B48F76870C2e0d5440dE8F5E7b7A6a7d52720"} 
        appId="40" 
        chain={"mumbai"} 
        defaultPayment='Premium'
        choice={{
              payment: "Premium",
              token: "0x8e468E7Cbf7E7E056A7591C796F2dd4C5C255591"
        }}
        dataOnSubs={handleResponse} 
/>

Options

You can choose multiple ways to present your button:

  • address: Address of the owner of the App
  • appId: App ID
  • chain: Network of your subscription plan
  • color: Customize the color of your button
  • width: Width of the component
  • defaultPayment: Payment name, if you want to show a particular payment
  • choice: Payment name and token address, prechoose and only keep the Subscribe button
  • response: Informs you if a subscription is done successfully.

Popup

If the Popup doesn't show up, some parts of your CSS may cause some issues.

First view of the Popup

First, you need to accept our terms and conditions by checking the check box.

Approval Step

Users will need to approve an amount of token before the subscription. We will later debit the amount with TransferFrom calls periodically.

Sign to Subscribe

When the approval is done, all you need to do is sign to trigger the subscription process.

Error Message

If the user doesn't have enough funds in their wallet, the first debit won't work, and no one will be charged for this action.

Success

Congratulations! If the transaction is a success, users will be charged from now on. It is possible to get the result thanks to dataOnSubs, the function will return the status of the operation and a message if an error happens.