@chimoney/chispend-widget

0.1.2 • Public • Published

ChiSpend Widget

A simple utility script for ChiSpend that handles embedding the ChiSpendWidget easily in your application. It also acts as a wrapper for the Pay With Wallet functionality and exposes it in a simple onData callback.

Installation

  • Include script tag in head of html document. This adds the script to the browser's window and you are able to access the class as ChiSpendWidget
<!-- add in site's  <head> -->
<script
  src="https://unpkg.com/@chimoney/chispend-widget/dist/main.js"
></script>

Usage

    <script>
        new ChiSpendWidget({
           // Dom string e.g (.myclass, button) or HTMLElement to insert ChiSpend
            insertionPoint: "#chispend-div", 
            // Chispend customizations. See: https://github.com/Chimoney/chispend-integration-examples/tree/main/web#customizing-chispend
            cutomizations: {
                cSContext: "web",
            },
           // Called when Pay With Wallet is clicked.
            onData: (data) => {
                alert(JSON.stringify(data, null , 2));
            },
            // Called when `ChiSpendWidget` loads.
            onLoad: () => {
                console.log("Loaded");
            },
        }); 
    </script>

Readme

Keywords

none

Package Sidebar

Install

npm i @chimoney/chispend-widget

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

4.1 kB

Total Files

5

Last publish

Collaborators

  • mide_dev
  • uchi4jah