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

@tenpayglobal/embed-finance

v1.0.3-0

Published

TenpayGlobal embed finance SDK

Downloads

2

Readme

TenpayGlobal EmbedFinance SDK

TenpayGlobal EmbedFinance SDK is a toolkit specially designed for frontend projects. With clear and concise core code, it mainly provides the following functions:
Type Declaration: We provide comprehensive type declarations for the SDK initialization parameters, entry methods, and embedded element methods.
Dynamic Loading and Instantiation: According to the initialization guide, the SDK will dynamically load the latest JS scripts and call the corresponding entry instance and methods.
Element Mounting: We offer methods for mounting embedded elements, providing greater flexibility for higher-level business parties.

npm version

Installation

Use npm to install the TenpayGlobal EmbedFinance SDK module:

npm install @tenpayglobal/embed-finance

Usage

init

The init method of the SDK is used for SDK initialization, specifying the required elements to load, the environment, and the language, and handling the information requiring authentication.
For detailed configuration, please contact your account manager.

import { init, createElement } from '@tenpayglobal/embed-finance';

await init({
    elements: [{ type: 'kyc', scene: 'wallet-cn' }],
    env: 'prod',
    langKey: 'zh_CN',
    auth: {
        spid: '<spid>',
        token: '<token>',
        sign: '<sign>'
    }
});

In the example code, the authentication information was replaced with angle brackets, please replace it with the actual authentication information. For the specific way to get it, you can contact the account manager.

createElement

After successfully initializing with the init method, you can call the createElement method to create an instance of the embedded component. Following this, use the mount method to mount the element onto the target element. After successful mounting, the platform can then access the TenpayGlobal page.

import { createElement } from '@tenpayglobal/embed-finance';

const element = createElement('kyc', {
  kyc_action_type: 'create'
})

element.mount('#iframe-container');

Handling Event

After successfully loading and mounting the component object, users can perform corresponding operations on the TenpayGlobal page. At different lifecycle stages, the module will throw corresponding events. Once the platform registers event callbacks, it will execute the corresponding callback methods at the appropriate times.

element.on('tgbs:finished', (data) => {
  console.log('receive finished data', data.kyc_action_type);
});

Destroy Instance

After completing the corresponding process operations, you can call the unmount and destroy methods to unload the loaded instance.

const kycElement = createElement('kyc');
kycElement.unmount();
kycElement.mount(document.getElementById('b-container'));

element.destroy();

TypeScript support

This package includes TypeScript declarations. We support projects using TypeScript versions >= 4.4.

Keywords

TenpayGlobal