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

@manifoldco/manifold-plan-table

v0.4.3

Published

Stencil Component Starter

Downloads

17

Readme

@manifoldco/manifold-plan-table

Built With Stencil

Getting Started

Place the following HTML where you’d like the component to appear (this works in any JS framework, or even no framework!):

<manifold-init client-id="[my client ID]"></manifold-init>
<manifold-plan-table product-id="[my product ID]" client-id="[my client ID]"></manifold-plan-table>

Note that the <manifold-init> component is required only once per page for all Manifold Components (along with its JS). If you have that installed already, you may skip that here and in the following steps.

Option 1: Manifold CDN

Place the following at the very beginning of the <body> tag:

<script async type="module" src="https://js.cdn.manifold.co/@manifoldco/manifold-init/dist/manifold-init/manifold-init.esm.js" ></script>
<script nomodule src="https://js.cdn.manifold.co/@manifoldco/manifold-init/dist/manifold-init/manifold-init.js" ></script>
<script async type="module" src="https://js.cdn.manifold.co/@manifoldco/manifold-plan-table/dist/manifold-plan-table/manifold-plan-table.esm.js" ></script>
<script nomodule src="https://js.cdn.manifold.co/@manifoldco/manifold-plan-table/dist/manifold-plan-table.js" ></script>

Place this component’s CSS in your <head> tag (optional if you want to write your own styles):

<link rel="stylesheet" href="https://js.cdn.manifold.co/@manifoldco/manifold-plan-table/dist/manifold-plan-table/manifold-plan-table.css" />

Option 2: npm

Alternately, if you build your site with npm using webpack, create-react-app, etc., run:

npm install @manifoldco/manifold-init @manifoldco/manifold-plan-table

And add the following code to your application, ideally to your entry file so it’s loaded as early as possible:

import('@manifoldco/manifold-init/loader').then(({ defineCustomElements }) =>
  defineCustomElements(window)
);
import('@manifoldco/manifold-plan-table/loader').then(({ defineCustomElements }) =>
  defineCustomElements(window)
);

Also if using CSS from npm, import the file in a way that works for your setup (for example, webpack):

import '@manifoldco/manifold-plan-table/dist/manifold-plan-table/manifold-plan-table.css';

This libary is built using Stencil. For more information about integrating with your site, please refer to the latest framework docs.

Options

Options are passed to the component in the form of HTML Attributes:

| Name | Required | Description | Example | | :----------- | :------: | :-------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------- | | product-id | Y | Your Product’s identifier | <manifold-plan-table product-id="234qkjvrptpy3thna4qttwt7m2nf6"> | | client-id | Y | Your Account identifier (this helps us associate analytics to your account) | <manifold-plan-table client-id="284ablb7scfm8oxwz9wrxpt2q0jii"> | | base-url | | The URL the buttons link to (plan ID & user selection will be appended to the end of the URL in a query string) | <manifold-plan-table base-url="/checkout"> | | cta-text | | Change the ”Getting Started” default text. | <manifold-plan-table cta-text="Buy Now!"> | | version | | The version of your product (omit for latest published product). Use version="latest" for the latest draft. | <manifold-plan-table version="1"> |

Events

This component emits [Custom JavaScript Events][custom-events] at key interaction points.

Setup

To begin listening for events, add a listener like so (you’ll want to make sure that this component exists in the DOM):

// your custom listener function
function myFunc(evt) {
  console.log(evt);
}

document.querySelector('manifold-plan-table').addEventListener('ctaClick', myFunc); // do something on CTA clicks
document.querySelector('manifold-plan-table').addEventListener('init', myFunc); // do something on initial load
document.querySelector('manifold-plan-table').addEventListener('update', myFunc); // do something on updates

All Events

| Event Name | Trigger | Returns | | :--------- | :-------------------------------------------------------------------------------------------------------------------- | :------------------------------------------- | | ctaClick | Fires when a user clicks the CTA | planID, planDisplayName, userSelection | | init | Fires once when the component has loaded (broadcasts default options for all plans) | defaultSelections | | update | Fires when a user selects a feature option (if you don’t have user-selectable features, you probably don’t need this) | planID, planDisplayName, userSelection |

TypeScript + JSX

This component works in all frameworks & environments, but when you first add the component in a JSX + TypeScript setup, you may see the following warning at first:

Property 'manifold-init' does not exist on type 'JSX.IntrinsicElements'.

To solve this, import the types this library ships with. Create a custom-elements.d.ts file anywhere in your project that’s within tsconfig.json’s includes:

import { JSX as ManifoldInit } from '@manifoldco/manifold-init/loader';
import { JSX as ManifoldPlanTable } from '@manifoldco/manifold-plan-table/loader';
import { DetailedHTMLProps, HTMLAttributes } from 'react';

type StencilProps<T> = { [P in keyof T]?: Omit<T[P], 'ref'> };
type ReactProps<T> = { [P in keyof T]?: DetailedHTMLProps<HTMLAttributes<T[P]>, T[P]> };

type StencilToReact = ReactProps<HTMLElementTagNameMap> &
  StencilProps<ManifoldInit.IntrinsicElements> &
  StencilProps<ManifoldPlanTable.IntrinsicElements>;
// add additional Manifold Component types here if needed

declare global {
  export namespace JSX {
    interface IntrinsicElements extends StencilToReact {}
  }
}

You’ll now get TypeScript errors if you mistype an attribute while still being able to use JSX features like refs:

<manifold-init fakeproperty="foo" />
// Property 'fakeproperty' does not exist on type …