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

dancecard-email-schemas

v0.1.7

Published

Schemas for objects for Dancecard Email Nurturing System

Downloads

19

Readme

Dancecard Email Schemas

NPM Package that defines schemas for objects used in the Dancecard Email/Lead Nurturing API. Allows for validation of objects.

Quickstart

Installation

npm install dancecard-email-schemas

Usage

import {
  Template, TemplateBlock, Token,
  Email, EmailSubtype, Program,
  Outcome
} from dancecard-email-schemas;

Objects

Template

| property | type | description | required | |----|---|---|---| | _id | string | Unique ID generated by database. | yes | | template_name | string | User provided Template ID/Name | yes | | template_type | string(enum) | String: either "Email" or "Page Behind" | yes | | url | string | URL where Jinja email template is stored | yes | | page_behind | Template | Object that denotes the name of the page behind template and its Unique ID generated by database. | yes | | blocks | Array<TemplateBlock> | List of all blocks that are in this email. | yes |

Template Block

Template Block object modeled from the following mockup. https://projects.invisionapp.com/freehand/document/7DJGRFO3e

| property | type | description | required | |----|---|---|---| | block_name | string | User provided Template Block ID/Name | yes | | block_short_name | string | User provided short version of Template Block ID/Name | yes | | placeholder | string | Block name used in templates | yes | | block_type | string(enum) | String: Either "Text", "CTA", "Video", "Gallery", or "File" | yes | | subtype_fields | TemplateBlockSubtype | An object that will contain any custom fields associated with a specific template block subtype | yes | | order | int | Relative ordering of block in relation to other blocks for this Template. Starts indexing at 0. | yes |

Template Block Subtype

| property | type | description | required | |----|---|---|---| | text_block_fields | TextBlockSubtype or null | All fields for a Template Block with block_type == "Text" otherwise this property will be null | yes | | cta_block_fields | CTABlockSubtype or null | All fields for a Template Block with block_type == "CTA" otherwise this property will be null | yes | | video_block_fields | VideoBlockSubtype or null | All fields for a Template Block with block_type == "Video" otherwise this property will be null | yes | | gallery_block_fields | GalleryBlockSubtype or null | All fields for a Template Block with block_type == "Gallery" | yes | | file_block_fields | FileBlockSubtype or null | All fields for a Template Block with block_type == "File" | yes |

Text Block Subtype

| property | type | description | required | |----|---|---|---| | formal | string | Formal text sent in an email | yes | | casual | string | Casual form of text sent in an email | yes |

CTA Block Subtype

| property | type | description | required | |----|---|---|---|

Video Block Subtype

| property | type | description | required | |----|---|---|---|

Gallery Block Subtype

| property | type | description | required | |----|---|---|---|

File Block Subtype

| property | type | description | required | |----|---|---|---|

Token

| property | type | description | required | |----|---|---|---| | _id | string | Unique ID generated by database. | yes | | token_name | string | User provided Token ID/Name | yes | | placeholder | string | Token placeholder used in email templates. | yes | | jinja_placeholder | string | Token placeholder used in the Jinja email templates. | yes | | end_user_visibility | boolean | If true show this token to end users in list of available tokens. If false do not show to end users in their list of available tokens. | yes | | all_program_visibility | boolean | If true show this token in list of available tokens for all programs. If false this token is to be shown only in the selected programs. | yes | | programs | Array<Program> | List of programs this token is visible for. | yes |

Email

| property | type | description | required | |----|---|---|---| | _id | string | Unique ID generated by database. | yes | | email_name | string | User provided Template ID/Name. | yes | | template | Template | Template that this Email is using. | yes | | cta_type | string(enum) | String: either "Gallery", "Video", or "Case Study" | yes | | cta_override | boolean | TODO: Talk to Colin about this | yes | | email_type | string(enum) | String: Either "First Email", "2+ Email", "Lifecycle Email", "Single Email", or "Opt-In Email" | yes | | subtype_fields | EmailSubtype | An object that will contain any custom fields associated with a specific email subtype | yes | | order | int | Relative ordering of this email versus other emails of the same email_type. For example if there are 8 total emails with 3 "first emails" and 5 "2+ emails" then the 3 first emails will have order ids of 0, 1, 2 and the 2+ emails will have order ids of 0, 1, 2, 3, 4 | yes |

Email Subtype

| property | type | description | required | |----|---|---|---| | first_email_fields | FirstEmailSubtype or null | All fields for an email with email_type == "First Email" otherwise this property will be null | yes | | single_email_fields | SingleEmailSubtype or null | All fields for an email with email_type == "Single Email" otherwise this property will be null | yes | | opt_in_email_fields | OptInEmailSubtype or null | All fields for an email with email_type == "Opt-In Email" otherwise this property will be null | yes |

First Email Subtype

| property | type | description | required | |----|---|---|---| | outcome | Outcome | An outcome object that this email is associated with. | yes |

Single Email Subtype

| property | type | description | required | |----|---|---|---| | subject | string | Subject line for single email. | yes | | salutation | string | Salutation used for single email. | yes | | body | string | Body of email used for single email. | | signature | string | Signature used for single email. | yes |

Opt-In Email Subtype

| property | type | description | required | |----|---|---|---| | subject | string | Subject line for opt-in email. | yes | | salutation | string | Salutation used for opt-in email. | yes | | body | string | Body of email used for opt-in email. | yes | | signature | string | Signature used for opt-in email. | yes |

Program

| property | type | description | required | |----|---|---|---| | _id | string | Unique ID generated by database. | yes | | program_name | string | User provided Program ID/Name. | yes | | created_on | int | Unix timestamp of creation date | yes | | created_on_friendly | string | MM/DD/YYYY date string of creation date. | yes | | updated_on | int | Unix timestamp of last update date. | yes | | updated_on_friendly | string | MM/DD/YYYY date string of last update date. | yes | | active | boolean | True if this program is active. False if this program is not active. | yes | | emails | Array<Email> | List of all emails in this program. | yes |

Outcome

These outcomes are setup in Dancecard.

| property | type | description | required | |----|---|---|---| | _id | string | Unique ID generated by database for outcome. | yes | | outcome_name | string | User provided name for outcome. | yes |

Validation

To validate an object after constructing it you simply need to import the EmailSchemasValidator object and the associated object schema. Once you have done that you can get a validation object by running the validate() function of the validator.

Following is an example of constructing and validating a Token object.

import { EmailSchemasValidator, Token } from 'dancecard-email-schemas'
let t = {
  _id = "atestid",
  token_name: "A test token",
  placeholder: "test placeholder",
  jinja_placeholder: "{test_token}",
  end_user_visibility: true,
  all_program_visibility: true,
  programs: []
}

console.log(EmailSchemasValidator.validate(t, Token))

Building

npm run build

Testing

npm run test