Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@manifoldco/component-plan-matrix

Package Overview
Dependencies
Maintainers
15
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@manifoldco/component-plan-matrix - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

dist/cjs/core-79f769b4.js

4

dist/cjs/loader.cjs.js

@@ -5,7 +5,7 @@ 'use strict';

const core = require('./core-8e5652e1.js');
const core = require('./core-79f769b4.js');
const defineCustomElements = (win, options) => {
return core.patchEsm().then(() => {
core.bootstrapLazy([["manifold-button_3.cjs",[[0,"manifold-plan-matrix",{"baseUrl":[1,"base-url"],"ctaText":[1,"cta-text"]}],[4,"manifold-button",{"href":[1]}],[0,"manifold-checkbox",{"inputId":[1,"input-id"],"name":[1],"checked":[4]}]]]], options);
core.bootstrapLazy([["manifold-button_7.cjs",[[0,"manifold-plan-matrix",{"productLabel":[1,"product-label"],"baseUrl":[1,"base-url"],"ctaText":[1,"cta-text"],"graphqlUrl":[1,"graphql-url"],"product":[32],"plans":[32],"labels":[32],"loading":[32]}],[0,"manifold-checkbox",{"inputId":[1,"input-id"],"name":[1],"checked":[4]}],[4,"manifold-button",{"href":[1]}],[0,"manifold-cost-tiers",{"minLimit":[2,"min-limit"],"maxLimit":[2,"max-limit"],"cost":[2],"unit":[1]}],[4,"manifold-metered"],[0,"manifold-thead",{"titleText":[1,"title-text"],"plan":[16]}],[0,"manifold-empty-cell"]]]], options);
});

@@ -12,0 +12,0 @@ };

'use strict';
const core = require('./core-8e5652e1.js');
const core = require('./core-79f769b4.js');
core.patchBrowser().then(options => {
return core.bootstrapLazy([["manifold-button_3.cjs",[[0,"manifold-plan-matrix",{"baseUrl":[1,"base-url"],"ctaText":[1,"cta-text"]}],[4,"manifold-button",{"href":[1]}],[0,"manifold-checkbox",{"inputId":[1,"input-id"],"name":[1],"checked":[4]}]]]], options);
return core.bootstrapLazy([["manifold-button_7.cjs",[[0,"manifold-plan-matrix",{"productLabel":[1,"product-label"],"baseUrl":[1,"base-url"],"ctaText":[1,"cta-text"],"graphqlUrl":[1,"graphql-url"],"product":[32],"plans":[32],"labels":[32],"loading":[32]}],[0,"manifold-checkbox",{"inputId":[1,"input-id"],"name":[1],"checked":[4]}],[4,"manifold-button",{"href":[1]}],[0,"manifold-cost-tiers",{"minLimit":[2,"min-limit"],"maxLimit":[2,"max-limit"],"cost":[2],"unit":[1]}],[4,"manifold-metered"],[0,"manifold-thead",{"titleText":[1,"title-text"],"plan":[16]}],[0,"manifold-empty-cell"]]]], options);
});

@@ -5,3 +5,7 @@ {

"components/manifold-checkbox/manifold-checkbox.js",
"components/manifold-plan-matrix/manifold-plan-matrix.js"
"components/manifold-cost-tiers/manifold-cost-tiers.js",
"components/manifold-empty-cell/manifold-empty-cell.js",
"components/manifold-metered/manifold-metered.js",
"components/manifold-plan-matrix/manifold-plan-matrix.js",
"components/manifold-thead/manifold-thead.js"
],

@@ -8,0 +12,0 @@ "compiler": {

import { h } from "@stencil/core";
export class ManifoldButton {
constructor() {
this.href = '';
}
render() {

@@ -20,7 +23,7 @@ return (h("a", { class: "mp--button", href: this.href },

"original": "string",
"resolved": "string",
"resolved": "string | undefined",
"references": {}
},
"required": false,
"optional": false,
"optional": true,
"docs": {

@@ -31,5 +34,6 @@ "tags": [],

"attribute": "href",
"reflect": false
"reflect": false,
"defaultValue": "''"
}
}; }
}
import { h } from "@stencil/core";
import { check } from '@manifoldco/icons';
export class ManifoldCheckbox {
constructor() {
this.inputId = '';
this.name = '';
this.checked = false;
}
render() {

@@ -9,3 +14,3 @@ return [

h("path", { d: check })),
h("span", { class: "mp--checkbox__blank" }, "\u2022"),
h("manifold-empty-cell", null),
];

@@ -26,7 +31,7 @@ }

"original": "string",
"resolved": "string",
"resolved": "string | undefined",
"references": {}
},
"required": false,
"optional": false,
"optional": true,
"docs": {

@@ -37,3 +42,4 @@ "tags": [],

"attribute": "input-id",
"reflect": false
"reflect": false,
"defaultValue": "''"
},

@@ -45,7 +51,7 @@ "name": {

"original": "string",
"resolved": "string",
"resolved": "string | undefined",
"references": {}
},
"required": false,
"optional": false,
"optional": true,
"docs": {

@@ -56,3 +62,4 @@ "tags": [],

"attribute": "name",
"reflect": false
"reflect": false,
"defaultValue": "''"
},

@@ -64,7 +71,7 @@ "checked": {

"original": "boolean",
"resolved": "boolean",
"resolved": "boolean | undefined",
"references": {}
},
"required": false,
"optional": false,
"optional": true,
"docs": {

@@ -75,5 +82,6 @@ "tags": [],

"attribute": "checked",
"reflect": false
"reflect": false,
"defaultValue": "false"
}
}; }
}
import { h } from "@stencil/core";
import query from './product.graphql';
const GRAPHQL_ENDPOINT = 'https://api.manifold.co/graphql';
export class ManifoldPricing {
constructor() {
// Passed product label to the graphql endpoint
this.productLabel = '';
// Base url for buttons
this.baseUrl = '/signup';
// CTA Text for buttons
this.ctaText = 'Get Started';
// Graphql enpoint (TEMP)
this.graphqlUrl = GRAPHQL_ENDPOINT;
// Table labels
this.labels = [];
// Loading state
this.loading = true;
}
componentWillLoad() {
const DEFAULT = 'ziggeo';
const variables = { label: this.productLabel || DEFAULT, first: 50 };
fetch(this.graphqlUrl || GRAPHQL_ENDPOINT, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
query,
variables,
}),
})
.then(res => {
return res.json();
})
.then(({ data }) => {
if (data.product) {
this.product = data.product;
this.createPlans();
}
});
}
createPlans() {
if (this.product) {
const plan = this.product.plans.edges.slice(0, 1).pop();
if (plan) {
const fixedFeatures = plan.node.fixedFeatures.edges.map(edge => edge.node.displayName);
const meteredFeatures = plan.node.meteredFeatures.edges.map(edge => edge.node.displayName);
// const configurableFeatures = plan.node.configurableFeatures.edges.map(
// edge => edge.node.displayName
// );
this.labels = [...fixedFeatures, ...meteredFeatures];
this.plans = this.product.plans.edges;
this.loading = false;
}
}
else {
console.warn('There was a problem with the API');
}
}
addClass(obj, baseClass = '') {

@@ -11,49 +62,56 @@ const conditionalClasses = Object.keys(obj).map(cl => (obj[cl] ? cl : ''));

}
fixedFeatures(displayValue, planIndex, rowIndex) {
if (displayValue === 'true' || displayValue === 'false') {
return (h("div", { class: "mp--cell mp--cell__body" },
h("manifold-checkbox", { "input-id": `${planIndex}-${this.labels[rowIndex]}`, name: this.labels[rowIndex], checked: displayValue === 'true' })));
}
return h("div", { class: "mp--cell mp--cell__body" }, displayValue);
}
meteredFeatures(numericDetails) {
if (numericDetails.costTiers.length === 0) {
return (h("div", { class: "mp--cell mp--cell__body" },
h("manifold-empty-cell", null)));
}
return (h("div", { class: "mp--cell mp--cell__body mp--cell__block" },
h("manifold-metered", null, numericDetails.costTiers.map(({ limit, cost }, i) => {
var _a;
const previous = numericDetails.costTiers[i - 1];
const min = ((_a = previous) === null || _a === void 0 ? void 0 : _a.limit) ? previous.limit : 0;
return (h("manifold-cost-tiers", { "min-limit": min, "max-limit": limit, cost: cost, unit: numericDetails.unit }));
}))));
}
configurableFeatures() {
return (h("div", { class: "mp--cell mp--cell__body" },
h("manifold-empty-cell", null)));
}
render() {
// Fake data
const plan = {
Name: 'Free',
Price: 'Free',
Users: '1',
'Live Streaming Tail': true,
'CLI Tail': false,
};
const plan2 = {
Name: 'Birch',
Price: '$1.50/GB',
Users: 'Up to 5',
'Live Streaming Tail': false,
'CLI Tail': false,
};
const plan3 = {
Name: 'Maple',
Price: '$2.00/GB',
Users: 'Up to 10',
'Live Streaming Tail': false,
'CLI Tail': false,
};
const lables = Object.keys(plan);
const plans = [plan, plan2, plan3, plan];
const gridColumns = plans.length;
const gridRows = Object.keys(plans[0]).length + 1; // Extra row for the "Get Started" row
if (this.loading) {
return h("div", null, "Loading...");
}
if (this.product && !this.product.plans) {
return h("div", null, "error");
}
const gridColumns = this.plans.length + 1;
const gridRows = this.labels.length + 2; // +1 for the "Get Started" row
// Pass column count into css grid
this.el.style.setProperty('--manifold-table-columns', `${gridColumns + 1}`);
this.el.style.setProperty('--manifold-table-columns', `${gridColumns}`);
this.el.style.setProperty('--manifold-table-rows', `${gridRows}`);
return (h("div", { class: "mp" },
h("div", { class: "mp--cell mp--cell__sticky mp--cell__bls mp--cell__al mp--cell__th mp--cell__thead mp--cell__bts mp--cell__rounded-tl" }),
lables.slice(1, lables.length).map(label => (h("div", { class: "mp--cell mp--cell__sticky mp--cell__bls mp--cell__al mp--cell__th" }, label))),
this.labels.map(label => {
return (h("div", { class: "mp--cell mp--cell__sticky mp--cell__bls mp--cell__al mp--cell__th" }, label));
}),
h("div", { class: "mp--cell mp--cell__sticky mp--cell__bls mp--cell__bbs mp--cell__al mp--cell__th mp--cell__rounded-bl" }),
plans.map((p, i) => [
Object.values(p).map((value, ii) => (h("div", { class: this.addClass({
'mp--cell__bts mp--cell__thead mp--cell__thead mp--cell__th': ii === 0,
'mp--cell__rounded-tr': ii === 0 && i === gridColumns - 1,
'mp--cell__body': ii !== 0,
}, 'mp--cell') },
typeof value === 'boolean' ? (h("manifold-checkbox", { "input-id": `${i}-${lables[ii]}`, name: lables[ii], checked: value })) : (value),
ii === 0 && (h("p", { class: "mp--plan-cost" },
"$100",
h("span", { class: "mp--subtext" }, "/mo"))),
ii === 0 && h("span", { class: "mp--subtext" }, " + metered use")))),
this.plans
.sort((a, b) => a.node.cost - b.node.cost)
.map((plan, i) => [
h("div", { class: this.addClass({
'mp--cell__brs mp--cell__rounded-br': i === gridColumns - 1,
'mp--cell__rounded-tr': i === gridColumns - 2,
}, 'mp--cell mp--cell__bts mp--cell__thead mp--cell__thead mp--cell__th') },
h("manifold-thead", { "title-text": plan.node.displayName, plan: plan })),
plan.node.fixedFeatures.edges.map((value, ii) => this.fixedFeatures(value.node.displayValue, i, ii)),
plan.node.meteredFeatures.edges.map(value => this.meteredFeatures(value.node.numericDetails)),
// plan.node.configurableFeatures.edges.map(() => this.configurableFeatures()),
h("div", { class: this.addClass({
'mp--cell__brs mp--cell__rounded-br': i === gridColumns - 2,
}, 'mp--cell mp--cell__body mp--cell__bbs') },

@@ -71,2 +129,20 @@ h("manifold-button", { href: this.baseUrl }, this.ctaText)),

static get properties() { return {
"productLabel": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string | undefined",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": ""
},
"attribute": "product-label",
"reflect": false,
"defaultValue": "''"
},
"baseUrl": {

@@ -107,5 +183,29 @@ "type": "string",

"defaultValue": "'Get Started'"
},
"graphqlUrl": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string | undefined",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": ""
},
"attribute": "graphql-url",
"reflect": false,
"defaultValue": "GRAPHQL_ENDPOINT"
}
}; }
static get states() { return {
"product": {},
"plans": {},
"labels": {},
"loading": {}
}; }
static get elementRef() { return "el"; }
}

@@ -1,1 +0,1 @@

import{p as t,b as a}from"./p-71fd23d4.js";t().then(t=>a([["p-btxep2bt",[[0,"manifold-plan-matrix",{baseUrl:[1,"base-url"],ctaText:[1,"cta-text"]}],[4,"manifold-button",{href:[1]}],[0,"manifold-checkbox",{inputId:[1,"input-id"],name:[1],checked:[4]}]]]],t));
import{p as t,b as a}from"./p-3fb78b3a.js";t().then(t=>a([["p-izqnwotd",[[0,"manifold-plan-matrix",{productLabel:[1,"product-label"],baseUrl:[1,"base-url"],ctaText:[1,"cta-text"],graphqlUrl:[1,"graphql-url"],product:[32],plans:[32],labels:[32],loading:[32]}],[0,"manifold-checkbox",{inputId:[1,"input-id"],name:[1],checked:[4]}],[4,"manifold-button",{href:[1]}],[0,"manifold-cost-tiers",{minLimit:[2,"min-limit"],maxLimit:[2,"max-limit"],cost:[2],unit:[1]}],[4,"manifold-metered"],[0,"manifold-thead",{titleText:[1,"title-text"],plan:[16]}],[0,"manifold-empty-cell"]]]],t));

@@ -10,17 +10,33 @@ /* eslint-disable */

import { HTMLStencilElement, JSXBase } from './stencil.core';
import {
ProductQuery,
} from 'types/graphql';
export namespace Components {
interface ManifoldButton {
'href': string;
'href'?: string;
}
interface ManifoldCheckbox {
'checked': boolean;
'inputId': string;
'name': string;
'checked'?: boolean;
'inputId'?: string;
'name'?: string;
}
interface ManifoldCostTiers {
'cost'?: number;
'maxLimit'?: number;
'minLimit'?: number;
'unit'?: string;
}
interface ManifoldEmptyCell {}
interface ManifoldMetered {}
interface ManifoldPlanMatrix {
'baseUrl'?: string;
'ctaText'?: string;
'graphqlUrl'?: string;
'productLabel'?: string;
}
interface ManifoldThead {
'plan'?: ProductQuery['product']['plans']['edges'][0];
'titleText'?: string;
}
}

@@ -43,2 +59,20 @@

interface HTMLManifoldCostTiersElement extends Components.ManifoldCostTiers, HTMLStencilElement {}
var HTMLManifoldCostTiersElement: {
prototype: HTMLManifoldCostTiersElement;
new (): HTMLManifoldCostTiersElement;
};
interface HTMLManifoldEmptyCellElement extends Components.ManifoldEmptyCell, HTMLStencilElement {}
var HTMLManifoldEmptyCellElement: {
prototype: HTMLManifoldEmptyCellElement;
new (): HTMLManifoldEmptyCellElement;
};
interface HTMLManifoldMeteredElement extends Components.ManifoldMetered, HTMLStencilElement {}
var HTMLManifoldMeteredElement: {
prototype: HTMLManifoldMeteredElement;
new (): HTMLManifoldMeteredElement;
};
interface HTMLManifoldPlanMatrixElement extends Components.ManifoldPlanMatrix, HTMLStencilElement {}

@@ -49,6 +83,16 @@ var HTMLManifoldPlanMatrixElement: {

};
interface HTMLManifoldTheadElement extends Components.ManifoldThead, HTMLStencilElement {}
var HTMLManifoldTheadElement: {
prototype: HTMLManifoldTheadElement;
new (): HTMLManifoldTheadElement;
};
interface HTMLElementTagNameMap {
'manifold-button': HTMLManifoldButtonElement;
'manifold-checkbox': HTMLManifoldCheckboxElement;
'manifold-cost-tiers': HTMLManifoldCostTiersElement;
'manifold-empty-cell': HTMLManifoldEmptyCellElement;
'manifold-metered': HTMLManifoldMeteredElement;
'manifold-plan-matrix': HTMLManifoldPlanMatrixElement;
'manifold-thead': HTMLManifoldTheadElement;
}

@@ -66,6 +110,20 @@ }

}
interface ManifoldCostTiers {
'cost'?: number;
'maxLimit'?: number;
'minLimit'?: number;
'unit'?: string;
}
interface ManifoldEmptyCell {}
interface ManifoldMetered {}
interface ManifoldPlanMatrix {
'baseUrl'?: string;
'ctaText'?: string;
'graphqlUrl'?: string;
'productLabel'?: string;
}
interface ManifoldThead {
'plan'?: ProductQuery['product']['plans']['edges'][0];
'titleText'?: string;
}

@@ -75,3 +133,7 @@ interface IntrinsicElements {

'manifold-checkbox': ManifoldCheckbox;
'manifold-cost-tiers': ManifoldCostTiers;
'manifold-empty-cell': ManifoldEmptyCell;
'manifold-metered': ManifoldMetered;
'manifold-plan-matrix': ManifoldPlanMatrix;
'manifold-thead': ManifoldThead;
}

@@ -88,3 +150,7 @@ }

'manifold-checkbox': LocalJSX.ManifoldCheckbox & JSXBase.HTMLAttributes<HTMLManifoldCheckboxElement>;
'manifold-cost-tiers': LocalJSX.ManifoldCostTiers & JSXBase.HTMLAttributes<HTMLManifoldCostTiersElement>;
'manifold-empty-cell': LocalJSX.ManifoldEmptyCell & JSXBase.HTMLAttributes<HTMLManifoldEmptyCellElement>;
'manifold-metered': LocalJSX.ManifoldMetered & JSXBase.HTMLAttributes<HTMLManifoldMeteredElement>;
'manifold-plan-matrix': LocalJSX.ManifoldPlanMatrix & JSXBase.HTMLAttributes<HTMLManifoldPlanMatrixElement>;
'manifold-thead': LocalJSX.ManifoldThead & JSXBase.HTMLAttributes<HTMLManifoldTheadElement>;
}

@@ -91,0 +157,0 @@ }

export declare class ManifoldButton {
href: string;
href?: string;
render(): any;
}
export declare class ManifoldCheckbox {
inputId: string;
name: string;
checked: boolean;
inputId?: string;
name?: string;
checked?: boolean;
render(): any[];
}

@@ -0,11 +1,24 @@

import { ProductQuery } from 'types/graphql';
declare type conditionalClassesObj = {
[name: string]: boolean;
};
declare type NumericDetails = ProductQuery['product']['plans']['edges'][0]['node']['meteredFeatures']['edges'][0]['node']['numericDetails'];
export declare class ManifoldPricing {
el: HTMLElement;
productLabel?: string;
baseUrl?: string;
ctaText?: string;
graphqlUrl?: string;
product?: ProductQuery['product'];
plans: ProductQuery['product']['plans']['edges'];
labels: string[];
loading: boolean;
componentWillLoad(): void;
createPlans(): void;
addClass(obj: conditionalClassesObj, baseClass?: string): string;
fixedFeatures(displayValue: string, planIndex: number, rowIndex: number): any;
meteredFeatures(numericDetails: NumericDetails): any;
configurableFeatures(): any;
render(): any;
}
export {};
{
"name": "@manifoldco/component-plan-matrix",
"version": "0.0.3",
"version": "0.0.4",
"private": false,

@@ -24,2 +24,3 @@ "description": "Stencil Component Starter",

"generate": "stencil generate",
"generate:gql": "graphql-codegen --config codegen.yml",
"lint": "npm run lint:js && npm run lint:css",

@@ -32,4 +33,4 @@ "lint:css": "stylelint 'src/**/*.css'",

"storybook": "start-storybook -p 6006",
"test": "stencil test --spec --e2e",
"test:watch": "stencil test --spec --e2e --watchAll"
"test": "stencil test --spec",
"test:watch": "stencil test --spec --watchAll"
},

@@ -40,2 +41,5 @@ "dependencies": {

"devDependencies": {
"@graphql-codegen/cli": "^1.12.2",
"@graphql-codegen/typescript": "^1.12.2",
"@graphql-codegen/typescript-operations": "^1.12.2",
"@manifoldco/eslint-plugin-stencil": "^0.4.1",

@@ -57,4 +61,6 @@ "@stencil/core": "^1.8.9",

"eslint-plugin-prettier": "^3.1.2",
"graphql": "^14.6.0",
"postcss-preset-env": "^6.7.0",
"prettier": "^1.19.1",
"rollup-pluginutils": "^2.8.2",
"stylelint": "^13.2.0",

@@ -61,0 +67,0 @@ "stylelint-config-prettier": "^8.0.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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