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

@paytomorrow/pt-mpe

v1.4.2

Published

PayTomorrow Monthly Payment Estimator

Downloads

19

Readme

PayTomorrow Monthly Payment Estimator (MPE)

Try MPE demo here http://mpe-demo.paytomorrow.com

NPM Setup

Installation

Via npm:

npm install @paytomorrow/pt-mpe

Usage

Import the module:


import { mpeInit } from "@paytomorrow/pt-mpe";

mpeInit({
    debugMode: false,
    enableMoreInfoLink: true,
    logoColor: "original",
    maxAmount: 5000,
    maxTerm: 24,
    minAmount: 500,
    mpeSelector: ".mpe",
    priceSelector: ".mpe-price",
    storeDisplayName: "Your Store Name",
    publicId: "YOUR_PUBLIC_ID"
})

HTML tag setup

Installation

Copy and paste this on your website:

<!-- Paste in head tag  -->
<link href="https://cdn.paytomorrow.com/css/pt-mpe.min.css" rel="stylesheet">

<!-- Paste in body tag  -->
<script type="text/javascript" src="https://cdn.paytomorrow.com/js/pt-mpe.min.js"></script>

Usage

<script>
    PayTomorrow.mpeInit({
        debugMode: false,
        enableMoreInfoLink: true,
        logoColor: "original",
        maxAmount: 5000,
        maxTerm: 24,
        minAmount: 500,
        mpeSelector: ".mpe",
        priceSelector: ".mpe-price",
        storeDisplayName: "Your Store Name",
        publicId: "YOUR_PUBLIC_ID"
    })
</script>

PayTomorrow MPE API

Public Methods

mpeInit(opt: MpeOptions): void;

Appends PayTomorrow's estimated monthly price to the desired CSS selector and adds an iframe that will be displayed when a user clicks on the monthly price.

NOTE: Use this method if you don't need custom UI for displaying the monthly price.

MpeOptions
interface MpeOptions {
  debugMode: boolean;
  enableMoreInfoLink: boolean;
  logoColor: "white" | "black" | "original";
  maxAmount: number;
  maxTerm: number;
  minAmount: number;
  mpeSelector: string;
  priceSelector: string;
  storeDisplayName: string;
  publicId: string;
  displayMicroOffers: boolean;
  displayPrimeOffers: boolean;
  maxMicroAmount: number;
  primeApr: number;
}

|Name|Type|Default|Description| |:--:|:--:|:-----:|:----------| |debugMode|{boolean}|false|Display PayTomorrow's MPE console logs for debugging errors.| |enableMoreInfoLink|{boolean}|true|Display a link under the MPE for opening the MPE popup.| |logoColor|{'white' or 'black' or 'original'}|'original'|PayTomorrow's logo color on the MPE.| |maxAmount|{number}|5000|Max price limit at which the MPE appears.| |maxTerm|{number}|24|Max financing term available on your PayTomorrow account.| |minAmount|{number}|500|Min price limit at which the MPE appears.| |mpeSelector|{string}|'.mpe'|CSS selector for the element in which the MPE will be added.| |priceSelector|{string}|'.mpe-price'|CSS selector for scanning product prices.| |storeDisplayName|{string}|'Your Favorite Merchant'|The store name you want us to display in the popup.| |publicId|{string}|''|Your publicId provided by PayTomorrow (check your Resources tab on the Dashboard).| |displayMicroOffers|{boolean}|false|Display Micro offers on purchases bellow the maxMicroAmount threshold.| |displayPrimeOffers|{boolean}|false|Display Prime offers for the maxTerm selected and the primeApr.| |maxMicroAmount|{number}|500|Maximum amount for a micro loan offer.| |primeApr|{number}|0|The apr used by the prime offers.|

getMonthlyPayment(amount: number, term: number, options?: MpeOptions): number;

Returns the estimated monthly price for the amount and finance term. The options parameter is optional.

addPayTomorrowIframe(storeDisplayName: string, publicId?: string, channel?: string): void;

Appends PayTomorrow's iframe to the bottom of your page and is hidden by default.

openMpeIframe(): void;

Displays PayTomorrow's iframe.