@manifoldco/web-components
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -5,3 +5,3 @@ import { Component, Event, Host, State, Prop, h, Watch, } from '@stencil/core'; | ||
import query from '../../graphql/EmbeddedProduct.graphql'; | ||
import { toUSD, displayRange } from '../../utils/cost'; | ||
import { toUSD, displayRange, displayMetered } from '../../utils/cost'; | ||
export class ManifoldPlanTable { | ||
@@ -102,6 +102,6 @@ constructor() { | ||
((_b = feature.units) === null || _b === void 0 ? void 0 : _b.single) || 'unit'))), | ||
h("tbody", null, feature.intRangeValues.map((range) => { | ||
h("tbody", null, feature.intRangeValues.map((range, idx) => { | ||
var _a, _b; | ||
return (h("tr", { class: "Manifold-Typography--Caption" }, | ||
h("td", null, displayRange(range.min, range.max, ((_a = feature.units) === null || _a === void 0 ? void 0 : _a.plural) || 'units')), | ||
h("td", null, displayMetered(range.min, range.max, ((_a = feature.units) === null || _a === void 0 ? void 0 : _a.plural) || 'units', idx)), | ||
h("td", null, | ||
@@ -108,0 +108,0 @@ toUSD(range.cost), |
@@ -24,1 +24,21 @@ export function toUSD(cents) { | ||
} | ||
export function displayMetered(lower, upper, unit, idx) { | ||
const format = (n) => { | ||
return new Intl.NumberFormat('en-US', { | ||
notation: 'compact', | ||
}).format(n); | ||
}; | ||
// only one tier | ||
if (lower === 0 && upper === -1) { | ||
return ''; | ||
} | ||
// if upper tier infinite | ||
if (upper === -1 || upper === undefined || upper === null) { | ||
return `Any additional ${unit}`; | ||
} | ||
if (idx === 0) { | ||
return `First ${format(upper)} ${unit}`; | ||
} | ||
// default | ||
return `Up to ${format(upper)} ${unit}`; | ||
} |
@@ -1,1 +0,1 @@ | ||
import{p as a,b as t}from"./p-8df06789.js";a().then(a=>t([["p-0adb32fd",[[1,"manifold-plan-table",{embed:[1],ctaText:[1,"cta-text"],baseUrl:[1,"base-url"],productData:[16],env:[1],product:[32],client:[32]}]]]],a)); | ||
import{p as a,b as t}from"./p-8df06789.js";a().then(a=>t([["p-ba72968a",[[1,"manifold-plan-table",{embed:[1],ctaText:[1,"cta-text"],baseUrl:[1,"base-url"],productData:[16],env:[1],product:[32],client:[32]}]]]],a)); |
@@ -1,1 +0,1 @@ | ||
System.register(["./p-40a5fb4b.system.js"],(function(){"use strict";var t,e;return{setters:[function(n){t=n.p;e=n.b}],execute:function(){t().then((function(t){return e([["p-07252ae3.system",[[1,"manifold-plan-table",{embed:[1],ctaText:[1,"cta-text"],baseUrl:[1,"base-url"],productData:[16],env:[1],product:[32],client:[32]}]]]],t)}))}}})); | ||
System.register(["./p-40a5fb4b.system.js"],(function(){"use strict";var t,e;return{setters:[function(n){t=n.p;e=n.b}],execute:function(){t().then((function(t){return e([["p-d7b93ada.system",[[1,"manifold-plan-table",{embed:[1],ctaText:[1,"cta-text"],baseUrl:[1,"base-url"],productData:[16],env:[1],product:[32],client:[32]}]]]],t)}))}}})); |
export declare function toUSD(cents: number): string; | ||
export declare function displayRange(lower: number, upper: number | undefined | null, unit: string): string; | ||
export declare function displayMetered(lower: number, upper: number | undefined | null, unit: string, idx: number): string; |
{ | ||
"name": "@manifoldco/web-components", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "Manifold's Web Components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1478255
24080