Skip to content

Instantly share code, notes, and snippets.

View Sebash93's full-sized avatar

Sebastian Hernández Sebash93

  • Customer.io
  • Medellín, Colombia
View GitHub Profile
export function shortenNumber([number], { maxChars = DEFAULT_MAX_CHARS } = {}) {
if (isNaN(number)) {
return '--';
}
if (isNone(maxChars)) {
maxChars = DEFAULT_MAX_CHARS;
}
let comma = format(',');
get messagingBanner() {
let { messagesAllotted, customersAllotted, messagesSent, totalCustomerCount, highWatermarkCustomersTotal } =
this.usageMetrics;
// Show banner only if user is not on trial plan
if (!this.billing.billingInfo?.trial) {
let customersCount = this.account.current.planIncludeChurn ? highWatermarkCustomersTotal : totalCustomerCount;
let messagesExceeded = false;
let limitBannerData = {};
if (messagesAllotted < messagesSent) {
messagesExceeded = true;
newItems = [
{
network: "facebook",
text: "post number 1",
},
{
network: "twitter",
text: "some twitter text",
},
{