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

email-templates-approve

v3.2.54

Published

Generate email templates

Downloads

58

Readme

Email Templates

This library is responsible for creating email templates

Installation

Use npm to install the package

npm install email-templates-approve

Usage

Basic example

import emailTemplates from "email-templates-approve/src/index";

const html = emailTemplates.generalNotification(data, lang);

Adding New Template

From the root directory, using the CLI you can run the following command

node new-template-script <templateName> 

This command will generate the most of the boilerplate needed for the new template. The console will print which files has been added to the project.

IMPORTANT! - Inside the main file (/src/index.js) a new function will be created by the CLI command. You need to add this function to the emailTemplates object which exported from this file. This is the only boilerplate action that needed to be done manually. Anyway, the console will tell you to do so after running the new-template-script command.

Template Debugging

Run npm start and an express server will be lunched. In the browser, navigate into localhost:5020/?templateName=<templateName>, replace the query variable with the desired template name (camel case, like how the template files names written).

To change the template data payload, just go to /src/constants/testingPayloads.constant.js and change the relevant object.

Publish

In order to publish your changes run the following command from anywhere inside the project. You should be member of the NPM repository package to be abele to do so.

npm version patch
npm publish

No need to increase the package version manually, its done by the prepublish npm script.

Interface

All the exposed functions accepts two arguments - data: any and lang: 'en' | 'he' (default 'en').

The type of data depends on the function we use:

  • singleContractExpirationNotification
data: {
  logo: string,
  name: string,
  vendorName: string,
  daysToExpire: string | number,
  expirationDate: string,
  actionUrl: string
}
  • multiContractExpirationNotification
data: {
  logo: string,
  name: string,
  contracts: {
    vendorName: string,
    daysToExpire: string | number,
    expirationDate: string
  }[],
  actionUrl: string
}
  • userInvite
data: {
  addresseeName: string,
  inviterName: string,
  buttonUrl: string
}
  • userInviteWithCredentials
data: {
  addresseeName: string,
  inviterName: string,
  companyName: string,
  username: string,
  code: string,
  buttonUrl: string,
}
  • goodsReceived
data: {
  items: {title: string, quantity: string | number},
  buttonUrl: string,
  linkUrl: string
}
  • purchaseAssign
data: {
  addresseeName: string,
  title: string,
  approvalFlow?: string,
  description?: string,
  isRequestedForHidden?: boolean,
  requestedForName?: string,
  requestedForTitle?: string,
  requestorName: string,
  requestorTitle?: string,
  swId?: string,
  vendorName?: string,
  vendorErpId?: string,
  budgetItem?: string,
  department?: string[],
  usdAmount: string | number,
  items?: {
    description: string,
    quantity: number,
    amount: number,
    currency: string,
    timeFrame?: {
      from: Date,
      to: Date
    }
  }[],
  approveUrl?: string,
  rejectUrl?: string,
  purchaseUrl: string,
  isCC?: boolean,
}
  • purchaseApprove
data: {
  addresseeName: string,
  buttonUrl: string,
  purchaseTitle: string,
  approverName: string,
  approverTitle: string,
  note?: string
  isCC?: boolean,
}
  • purchaseApproveWithPo
data: {
  addresseeName: string,
  buttonUrl: string,
  purchaseTitle: string,
  approverName: string,
  approverTitle?: string,
  poNumber: string,
  note?: string
  isCC?: boolean,
}
  • purchaseReject
data: {
  addresseeName: string,
  buttonUrl: string,
  purchaseTitle: string,
  approverName: string,
  approverTitle?: string,
  note?: string
  isCC?: boolean,
}
  • purchaseReturn
data: {
  addresseeName: string,
  title: string,
  approverName: string,
  approverTitle?: string,
  note?: string,
  buttonUrl: string
}
  • purchaseDelegateForward
data: {
  addresseeName: string,
  approverName: string,
  approverTitle?: string,
  title: string,
  note?: string,
  approvalFlow?: string,
  description: string,
  isRequestedForHidden?: boolean,
  requestedForName?: string,
  requestedForTitle?: string,
  requestorName: string,
  requestorTitle?: string,
  swId?: string,
  vendorName?: string,
  vendorErpId?: string,
  budgetItem?: string,
  department?: string[],
  usdAmount: string | number,
  items: {
    description: string,
    quantity: number,
    amount: number,
    currency: string,
    timeFrame?: {
      from: Date,
      to: Date
    }
  }[],
  replyUrl?: string,
  purchaseUrl: string,
  isCC?: boolean,
}
  • purchaseDelegateBackward
data: {
  title: string,
  addresseeName: string,
  approverName: string,
  approverNodeName: string,
  note?: string
  buttonUrl: string
}
  • vendorApprove
data: {
  companyName: string,
  vendorName: string,,
  isCC?: boolean,
}
  • vendorApproveForVendor
data: {
  vendorLogoUrl: string,
  companyName: string,
  isCC?: boolean,
}
  • vendorReject
data: {
  logoUrl: string,
  addresseeName: string,
  buttonUrl: string,
  vendorName: string,
  approverName: string,
  approverTitle?: string,
  isCC?: boolean,
}
  • vendorRejectForVendor
data: {
  logoUrl: string,
  companyName: string,
  approverName: string,
  note?: string,
  isCC?: boolean,
}
  • vendorReturnForVendor
data: {
  logoUrl: string,
  vendorName: string,
  approverName: string,
  companyName: string,
  buttonUrl: string,
  note?: string,
  isCC?: boolean,
}
  • vendorInvite
data: {
  logoUrl: string,
  inviterName: string,
  companyName: string,
  invitationNote?: string
  buttonUrl: string,
  isCC?: boolean,
}
  • vendorAssign
data: {
  logoUrl: string,
  addresseeName: string,
  vendorName: string,
  vendorDescription: string,
  vendorOwnerName: string,
  goToVendorUrl: string
}
  • vendorDelegateForward
data: {
  logoUrl: string,
  addresseeName: string,
  addressedName: string,
  vendorName: string,
  vendorDescription?: string,
  vendorOwnerName: string,
  vendorOwnerEmail: string,
  buttonUrl: string,
  enterApproveUrl: string,
}
  • vendorReturn
data: {
  logoUrl: string,
  addresseeName: string,
  approverName: string,
  vendorName: string,
  note?: string,
  buttonUrl: string,
}
  • contractrsExpirationReminder
data: {
  addresseeName: string,
  contracts: {
    vendorName: string,
    daysToExpire: string,
    expirationDate: string,
  }[],
  actionUrl: string,
}
  • goodsReceivedReminder
data: {
  addresseeName: string,
  items: {
    description: string,
    quantity: number | string,
  }[],
  buttonUrl: string,
}
  • purchasesActionReminder
data: {
  addresseeName: string,
  purchases: {
    title: string,
    url: string
  }[],
    daysCount: number | string,
    buttonUrl: string,
}
  • contractApprove
data: {
  title: string,
  approverName: string,
  approverTitle: string,
  note: string,
  contractUrl: string,
}
  • contractAssign
data: {
  title: string,
  description: string,
  vendorName: string,
  datesRange: '01/01/2021 - 31/12/20201',
  contractTerm: string,
  contractUrl: string,
  contractsUrl: string,
}
  • contractDelegateBackward
data: {
  addresseeName: string,
  addresserName: string,
  title: string,
  note: string,
  contractUrl: string,
}
  • contractDelegateForward
data: {
  addresseeName: string
  addresserName: string,
  title: string,
  description: string,
  vendorName: string,
  datesRange: '01/01/20201 - 31/12/2021',
  contractTerm: string,
  replyUrl: string,
  approveUrl: string,
}
  • contractReject
data: {
  title: string,
  addresserName: string,
  addresserTitle: string,
  note: string,
  contractUrl: string,
}
  • contractReturn
data: {
  addresseeName: string,
  title: string,
  addresserName: string,
  addresserTitle: string,
  note: string,
  contractUrl: string,
}
  • forgotPassword
data: {
  addresseeName: string,
  code: string,
}
  • vendor-register-externally
data: {
  contactName: string,
  requestorName: string,
  description: string,
  swId: string,
  purchaseUrl: string,
  vendorName: string
}