New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@shreya-thapa/test-react-drop-ins

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shreya-thapa/test-react-drop-ins

React bindings for Dwolla's drop-in components

  • 1.0.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-drop-ins npm version

React bindings for Dwolla's drop-in components. This library provides a React hook for importing the dwolla-web.js library and a set of React components for using the drop-in components.

Table of Contents

Installation

# using npm
$ npm install --save @dwolla/react-drop-ins

# using yarn
$ yarn add @dwolla/react-drop-ins

# using pnpm
$ pnpm add @dwolla/react-drop-ins

Usage

In order to use this package, you will first need to set up your application to be able to make calls to the Dwolla API. You can use one of our SDKs in your preferred language to get up and running quickly.

Then you will need to set up a server-side endpoint for generating client tokens. You can do this by following the steps in the Generate a Client Token guide.

You're now ready to start using the package!

Create a configuration object for the useDwollaWeb hook as shown in the code example below. This hook will import the dwolla-web.js library and handle any errors that may occur during import.

The full list of configuration options for the hook can be found in the table below.

// Import the useDwollaWeb hook and the DwollaCustomerCreate component
import { DwollaCustomerCreate, DwollaWebOptions, useDwollaWeb } from 'react-drop-ins';

// Create configuration for the useDwollaWeb hook
const config: DwollaWebOptions = {
environment: 'sandbox',
onError: function error() {
    console.log('Error');
},
onSuccess: function success() {
    console.log('Success');
},
tokenUrl: '/yourTokenUrl'
};

const App = () => {
  // Initialize the useDwollaWeb hook
  const { ready, error } = useDwollaWeb(config);

  // Wait for the hook to be ready
  if (!ready) return <div>Loading...</div>;

  // Handle errors
  if (error) return <div>Error</div>;

  // Render the DwollaCustomerCreate component when ready
  return (
    <>
      <DwollaCustomerCreate />
    </>
  );
};

export default App;

Configuration options for useDwollaWeb

ParameterTypeRequired?Description
environmentstringyesAcceptable values of: sandbox or production
stylesstringnoOptional. A relative or absolute URL linking to a hosted stylesheet containing component styles.
tokenfunctionconditionalA function that gets called by the component for fetching client-tokens as needed throughout the flow.
Example usage: token: (req) => Promise.resolve(dwollaAPIToken(req, {blah: "abcd"}))
Not required if tokenUrl is used.
tokenUrlfunctionconditionalA URL pointing to a server-side endpoint that can be used to generate client-token.
Example usage: tokenUrl: "tokenUrl".
Not required if token is used.
successfunctionnoA function that gets called upon a successful request from the Component.
errorfunctionnoA function that gets called when an error occurs in the Component.

Note: You can use either token or tokenUrl in the config options for generating a client token, but not both. Check out the tokenUrl vs token configuration section in the docs for more information on the differences between the two.

Examples

An example React component demonstrating how to use the library and the DwollaCustomerCreate component can be found in the examples directory.

For a full list of all available components and their usage, check out the Storybook. Switch to the Docs tab and click on Show code to see the implementation code example for each component.

Changelog

  • 1.0.0 Initial release of React bindings for Dwolla's drop-in components.

Community

Additional Resources

To learn more about Dwolla and how to integrate our product with your application, please consider visiting some of the following resources and becoming a member of our community!

Keywords

FAQs

Package last updated on 17 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc