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

chimoney-react-components

v1.1.5

Published

A modern, flexible React component library for integrating Chimoney payment functionality. Send payments to multiple recipients via email or phone numbers with a beautiful, responsive interface. Features

Downloads

524

Readme

A modern, flexible React component library for integrating Chimoney payment functionality. Send payments to multiple recipients via email or phone numbers with a beautiful, responsive interface. Features

  • 🎯 Multi-recipient payment support (email and phone)
  • 💱 Multi-currency support (USD, KES, CAD)
  • 🎨 Modern UI with Tailwind CSS styling
  • 🧪 Test mode for development
  • 📱 Fully responsive design
  • ⌨️ TypeScript support
  • 🔄 Real-time payment type switching

Installation

# Using npm

npm install chimoney-react-components

or using yarn

yarn add chimoney-react-components

Required Imports Make sure to import both the component and the required styles in your application: Import the styles (required)

import "chimoney-react-components/styles.css";
// Import the components
import {
ChimoneyPayment,
UserAccountForm,
ChimoneyTransactionList
} from 'chimoney-react-payment';

⚠️ Important: The styles.css import is required for proper component styling and functionality. Quick Start

import "chimoney-react-components/styles.css";
import { ChimoneyPayment } from 'chimoney-react-payment';

function App() {
const handlePayment = (paymentData) => {
console.log('Payment Data:', paymentData);
// Handle payment submission
};

return (
<ChimoneyPayment
      onSubmit={handlePayment}
      testMode={false}
      className="max-w-md mx-auto"
    />
);
}

Components

ChimoneyPayment

The main payment form component with support for multiple recipients and payment types.

Props

interface ChimoneyPaymentProps {
onSubmit: (data: ChimoneyPaymentData) => void;
className?: string;
testMode?: boolean;
}


interface ChimoneyPaymentData {
amount: string;
emails: string[];
paymentType: "email" | "phone";
}

ChimoneyInput

Custom input component used within the payment form.

interface ChimoneyInputProps {
type: string;
value: string;
onChange: (e: React.ChangeEvent) => void;
className?: string;
placeholder?: string;
}

ChimoneyButton

Custom button component for form submission.

interface ChimoneyButtonProps {
type: "submit" | "button";
className?: string;
buttonName: string;
onClick?: () => void;
}

Usage Examples

Basic transaction list component

chimoney

import { ChimoneyPayment } from 'chimoney-react-payment';

function PaymentForm() {
 const [transactions, setTransactions] = useState([])
 const handlePayment = (paymentData: {
    amount: number;
    currency: string;
    paymentTo: string;
    emails: string;
  }) => {
    // In a real app, you would send this data to your backend
    console.log("Processing payment:", paymentData);
    // For demo purposes, we'll add it to our transactions
    setTransactions([
      ...transactions,
      {
        amount: paymentData.amount,
        currency: paymentData.currency,
        transactionDate: new Date().toISOString().split("T")[0],
        initiator: paymentData.paymentTo,
        receiver: paymentData.emails,
        fee: 0,
        paymentStatus: "",
        deliveryStatus: "",
        ref: "",
      },
    ]);
  };

return (
 <ChimoneyPayment
          onSubmit={handlePayment}
          testMode={false} // Set to false for production
          className="px-6 flex flex-col gap-4"
/>
)
}

export default PaymentForm;

Test Mode with Custom Styling

import { ChimoneyPayment } from 'chimoney-react-payment';

function TestPaymentForm() {
return (
<ChimoneyPayment
onSubmit={(data) => console.log('Test payment:', data)}
testMode={true}
className="bg-gray-50 p-8"
/>
);
}

interface ChimoneyTransactionListProps {
transactions: ChimoneyTransaction[];
className?: string;
}

interface ChimoneyTransaction {
amount: number;
currency: string;
transactionDate: string;
initiator: string;
receiver: string;
fee: number;
paymentStatus: string;
deliveryStatus: string;
ref: string;
}

Usage Example

ChimoneyTransactionList

import { ChimoneyTransactionList } from 'chimoney-react-payment';

function TransactionHistory() {
const transactions = [
{
amount: 100,
currency: "USD",
transactionDate: "2023-10-26",
initiator: "John Doe",
receiver: "Jane Doe",
fee: 0,
paymentStatus: "Completed",
deliveryStatus: "Delivered",
ref: "1234567890",
},
{
amount: 50,
currency: "KES",
transactionDate: "2023-10-25",
initiator: "Alice Smith",
receiver: "Bob Johnson",
fee: 0,
paymentStatus: "Pending",
deliveryStatus: "Pending",
ref: "9876543210",
},
];

return (
<ChimoneyTransactionList transactions={transactions} className="max-w-md mx-auto" />
);
}

User Account Form

import { UserAccountForm } from 'chimoney-react-payment';

function AccountPage() {
const handleAccountUpdate = (data) => {
console.log('Account Data:', data);
// Handle account update
};

return (
<UserAccountForm
      onSubmit={handleAccountUpdate}
      className="max-w-md mx-auto"
    />
);
}

Development Prerequisites

  • Node.js
  • React
  • TypeScript
  • Tailwind CSS#
  • Install Node.js https://nodejs.org/en/download/

Install React

npm install -g create-react-app

Install TypeScript

npm install -g typescript

Install Tailwind CSS

npm install -D tailwindcss postcss autoprefixer

Configuration

  1. Create a new React project with TypeScript support:

npx create-react-app my-chimoney-app --template typescript

  1. Initialize Tailwind CSS:

npx tailwindcss init -p

  1. Add the following to your tailwind.config.js file:
module.exports = {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}`
  1. Add the following to your postcss.config.js file:
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
  1. Install the Chimoney React components:

npm install chimoney-react-payment

  1. Import the styles in your index.css file:
@tailwind base;
@tailwind components;
@tailwind utilities;

import "chimoney-react-components/styles.css";
  1. Start the development server:

npm run dev

Building for Production


npm run build

Testing

Running Tests

npm test

Setup

Clone the repository
git clone [email protected]:Benjamin-23/chimoney-community-projects.git
cd chimoney-community-projects/submissions/chimoney-react-components

Install dependencies

npm install

Run development server

npm run dev

Contributing We welcome contributions! Please follow these steps:

Fork the repository

  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

License This project is licensed under the MIT License - see the LICENSE file for details. Support

Acknowledgments

Built with React and TypeScript Styled with Tailwind CSS Inspired by modern payment interfaces