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 🙏

© 2025 – Pkg Stats / Ryan Hefner

maker-ramp-edge

v2.0.9

Published

Client library for fetching product groups from API

Downloads

50

Readme

Maker.RampEdge

Maker.RampEdge is a comprehensive client library for interacting with the Maker Platform API. It provides a seamless interface for managing product groups, user authentication, shopping carts, and e-commerce operations. The library handles all the complexity of API communication, token management, and error handling, allowing developers to focus on building their applications.

Features

  • Robust Authentication

    • Token-based authentication system
    • Automatic token refresh handling
    • Secure token storage management
    • SSO integration support
  • E-commerce Integration

    • Shopping cart management
    • Product catalog access
    • Order processing
    • Stripe payment integration
    • Address management
  • Developer Experience

    • Automatic error handling
    • Type-safe API interfaces
    • Comprehensive documentation
    • Easy-to-use API methods
    • Built-in retry mechanisms
    • Request/Response interceptors
  • Performance & Security

    • Efficient request caching
    • Automatic token renewal
    • Secure credential handling
    • Rate limiting protection
    • Connection pooling

Available methods (summary)

Authentication Methods

  • registerUser(email, password) - Register a new user
  • login(username, password) - Login and get authentication tokens
  • refreshToken() - Refresh an expired access token
  • requestSsoCode() - Request SSO authentication code

Authorized Methods (Requires Authentication)

  • getAllOrders(page, pageSize) - Get user's order history
  • getUser(userDetail) - Get user profile information
  • getCart() - Get user's shopping cart
  • clearCart() - Clear user's shopping cart
  • getAddress() - Get user's saved addresses
  • upsertAddress(request) - Create or update user's address
  • addProductsToCart(cartItems) - Add items to cart
  • removeProductFromCart(slug) - Remove item from cart
  • createCheckoutSession(request) - Create Stripe checkout session
  • addProductReport(request) - Submit a product report
  • updateProductReport(request) - Update an existing report
  • addRating(request) - Add product rating
  • insertUserActivity(request) - Track user activity
  • sendStripeWebhook(payloadJson, signature) - Process Stripe webhook (testing helper)

Public Methods (No Authentication Required)

  • getProductGroups() - Get all product groups
  • getProductsBySlug(slug) - Get product by slug
  • getProductDetails(request) - Get detailed product information
  • getReportByProduct(barID) - Get product reports
  • getRatingByProduct({ barID }) - Get product ratings
  • getAboutInfo() - Get about page information
  • getBlogs() - Get blog posts
  • getDocumentation() - Get documentation
  • getServices() - Get available services

Installation

npm install

Install the main package:

npm install maker-ramp-edge
npm install dotenv

Required peer dependencies:

npm install axios

Configure Environment Variables

Create a .env file at the root of your project:

BUSINESS_UNIT_KEY=your_business_unit_key
API_BASE_URL=https://your.api.base.url

Note: All methods return a promise which resolves to the API response (or throws an error via the client's error handler). For authorized methods, the client automatically handles token management - you don't need to pass tokens manually.

Add this to the top of your index.js to load .env variables:

import dotenv from 'dotenv';
dotenv.config();

Basic Usage

Initializing the Client

The ProductGroupClient requires two parameters: businessUnitKey and apiBaseUrl.

import { ProductGroupClient } from 'maker-ramp-edge';

const client = new ProductGroupClient(
  "YOUR_BUSINESS_UNIT_KEY",
  "https://your-api-base-url.com"
);

Authentication and Protected Endpoints Example

import { ProductGroupClient } from 'maker-ramp-edge';

async function example() {
  // Initialize the client
   const client = new ProductGroupClient(
    'your-business-unit-key',
    'https://your-api-base-url.com'
  );

  try {
    // Login to get authentication tokens
    await client.login('[email protected]', 'your-password');
    
    // After successful login, tokens are automatically stored
    // Now you can call any protected endpoint
    
    // Example: Get user's cart
    const cart = await client.getCart();
    console.log('Cart contents:', cart);
    
    // The client will automatically:
    // - Use the stored token for authentication
    // - Refresh the token if it expires
    // - Handle unauthorized errors
  } catch (error) {
    console.error('Error:', error.message);
  }
}

Example in React Component

import { ProductGroupClient } from 'maker-ramp-edge';

// Create a new instance with your business unit key
const client = new ProductGroupClient(
    'your-business-unit-key',
    'https://your-api-base-url.com'
  );

// Example usage in a React component
function ProductList() {
  const [products, setProducts] = useState([]);
  const [error, setError] = useState(null);

  useEffect(() => {
    async function fetchProducts() {
      try {
        const data = await client.getProductGroups();
        setProducts(data.products);
      } catch (err) {
        setError(err.message);
      }
    }

    fetchProducts();
  }, []);

  if (error) return <div>Error: {error}</div>;
  if (!products) return <div>Loading...</div>;

  return (
    <div>
      {products.map(product => (
        <div key={product.slug}>
          <h2>{product.name}</h2>
          <p>ID: {product.friendlyID}</p>
          {product.asset && <img src={product.asset.url} alt={product.name} />}
        </div>
      ))}
    </div>
  );
}

Project Structure

Node.js Client (maker-ramp-edge)

Maker.RampEdge/
├── src/
│   ├── index.js          # Main client implementation
│   └── tokenStorage.js   # Token management implementation
├── bin/
│   └── print-products.js # CLI utilities
├── dist/                 # Compiled output
│   ├── index.js
│   └── index.js.map
├── package.json         # Project configuration
├── tsconfig.json       # TypeScript configuration
├── .babelrc           # Babel configuration
└── .env              # Environment variables