0.0.2 • Published 1 year ago

@spritz-finance/react-secure-elements v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

@spritz-finance/react-secure-elements

NPM

Introduction

Official react components for Spritz Finance.

Install

npm install --save @spritz-finance/react-secure-elements

or

yarn add @spritz-finance/react-secure-elements

Usage

import React from 'react'
import { SpritzCard, Environment } from '@spritz-finance/react-secure-elements'

const App = () => {
    const [tokens, setTokens] = React.useState<{ apiKey: string; renderSecret: string}>(null)

    React.useEffect(() => {
        // Get the renderSecret for the SpritzCard from the api
        // Pass in the renderSecret along with the users api key
        setTokens({
            apiKey: 'ak_MzY5YWJ...',
            renderSecret: 'U2FsdGVkX18bLYGYL...'
        }
    })

    if (!tokens) return null

    return (
        <SpritzCard
            environment={Environment.Staging}
            apiKey={tokens.apiKey}
            renderSecret={tokens.renderSecret}
            onCopyText={(text) => console.log('onCopyText', text)}
            onDetailsLoaded={() => console.log('Card details loaded')}
        />
    )
}

export default App
0.0.2

1 year ago

0.0.1

2 years ago