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

@chainvine/widget

v0.11.1

Published

ChainVine Widget

Downloads

237

Readme

status npm npm bundle size npm

Table of Contents

🔍 About

Chainvine Widget is an embeddable widget UI that allows you to display referral and reward data to your users on your website. Its built against ChainVine's all-in-one solution for Referral & Affiliate marketing.

The widget allows you to get started quickly. Avoids having to invest the front-end work required to do so.

Simply add widget to your website and if needed customize the experience by interacting with our SDK to capture referral links, retrieve rewards, fetch completed objectives, etc.

🚀 Getting Started

Features

  • Supports CommonJS AND ESM, therefore browsers and node environments with modern bundlers
  • Depends on React but excludes react and read-dom dependencies
  • Supports client-side and server-side rendering (like NextJS)
  • Includes Typescript definition files

Requirements

  • Node: v18.17.1
  • React: v18+

Installation

npm  install  @chainvine/widget

Documentation

For more details, refer to our documentation amongst:

Usage

We support different use cases: client-side, server-side and through our SDK. Using either API key or allow-listed domain.

import React, { useState } from "react";
import { ChainvineWidget } from "@chainvine/widget";

// 📌 Adapt the following accordingly...
//
// 1️⃣ A unique identifier for the user, generally a wallet address is preferred, but we accept any string
const userIdentifier = '0x1234567890';
//
// 2️⃣ The type of identifier you're setting - we support 'wallet', 'email', and 'externalId'
const identifierType = 'wallet';
//
// 3️⃣ The campaign id you created in your community at https://chainvine.xyz
const campaignId = 'ABC123';
//
// 4️⃣ Add your domain to white-list (https://docs.chainvine.xyz/developers/sdk/classes-and-functions/authentication/allow-listing-a-domain)

export const ChainvineWidgetAndButton = () => {
  const [isOpen, setIsOpen] = useState<boolean>(true);

  return (
    <ChainvineWidget
      isOpen={isOpen}
      userIdentifier={userIdentifier}
      identifierType={identifierType}
      campaignId={campaignId}
      clientConfig={{
        testMode: true,
        logToConsole: true,
      }}
      onClose={() => setIsOpen(false)}
    >
      <button
        type={"submit"}
        onClick={() => {
          setIsOpen(true);
        }}
      >
        Open Widget
      </button>
    </ChainvineWidget>
  );
};

Authorization

We proposed two methods of interacting with the ChainVine Widget: API Key or by omitting the API key and ensuring all requests are sent from a previously allow-listed domains.

It is advised to use the API key method as it is more secure and allows you to use Widget from any domain, but only if you are operating from a server context (i.e. from an API, or SSR framework such as NextJS) as you do not want to expose your API key in a browser.

Support

If you have any questions or need support, feel free to reach out to us at