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

@sendgrid/helpers

Package Overview
Dependencies
Maintainers
21
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sendgrid/helpers - npm Package Compare versions

Comparing version 6.4.0 to 6.5.0

LICENSE.md

7

classes/mail.d.ts

@@ -156,2 +156,4 @@ import {AttachmentData, AttachmentJSON} from "./attachment";

dynamicTemplateData?: { [key: string]: any },
hideWarnings?: boolean,
}

@@ -329,2 +331,7 @@

/**
* Set hide warnings
*/
setHideWarnings(hide: boolean): void;
/**
* To JSON

@@ -331,0 +338,0 @@ */

30

classes/mail.js

@@ -26,2 +26,3 @@ 'use strict';

this.isDynamic = false;
this.hideWarnings = false;
this.personalizations = [];

@@ -70,2 +71,3 @@ this.attachments = [];

trackingSettings, substitutions, substitutionWrappers, dynamicTemplateData, isMultiple,
hideWarnings,
} = data;

@@ -91,2 +93,3 @@

this.setTrackingSettings(trackingSettings);
this.setHideWarnings(hideWarnings);

@@ -251,3 +254,3 @@ if (this.isDynamic) {

}
else if (personalization.dynamicTemplateData) {
else if (!this.isDynamic && personalization.dynamicTemplateData) {
delete personalization.dynamicTemplateData;

@@ -346,7 +349,9 @@ }

// Check dynamic template for non-escaped characters and warn if found
Object.values(dynamicTemplateData).forEach(value => {
if (/['"&]/.test(value)) {
console.warn(DYNAMIC_TEMPLATE_CHAR_WARNING);
}
});
if (!this.hideWarnings) {
Object.values(dynamicTemplateData).forEach(value => {
if (/['"&]/.test(value)) {
console.warn(DYNAMIC_TEMPLATE_CHAR_WARNING);
}
});
}

@@ -540,2 +545,15 @@ this.dynamicTemplateData = dynamicTemplateData;

/**
* Set hide warnings
*/
setHideWarnings(hide) {
if (typeof hide === 'undefined') {
return;
}
if (typeof hide !== 'boolean') {
throw new Error('Boolean expected for `hideWarnings`');
}
this.hideWarnings = hide;
}
/**
* To JSON

@@ -542,0 +560,0 @@ */

4

classes/personalization.d.ts

@@ -10,3 +10,3 @@ import { EmailData, EmailJSON } from "./email-address";

substitutions?: { [key: string]: string };
dynamicTemplateData?: { [key: string]: string; };
dynamicTemplateData?: { [key: string]: any; };
customArgs?: { [key: string]: string };

@@ -116,3 +116,3 @@ sendAt?: number;

*/
setDynamicTemplateData(dynamicTemplateData: { [key: string]: string }): void;
setDynamicTemplateData(dynamicTemplateData: { [key: string]: any }): void;

@@ -119,0 +119,0 @@ /**

@@ -10,3 +10,3 @@ 'use strict';

const deepClone = require('../helpers/deep-clone');
const merge = require('deepmerge');
const deepMerge = require('deepmerge');
const wrapSubstitutions = require('../helpers/wrap-substitutions');

@@ -290,3 +290,3 @@

}
this.dynamicTemplateData = merge(dynamicTemplateData, this.dynamicTemplateData);
this.dynamicTemplateData = deepMerge(dynamicTemplateData, this.dynamicTemplateData);
}

@@ -293,0 +293,0 @@

const DYNAMIC_TEMPLATE_CHAR_WARNING = `
Content with characters ', " or & may need to be escaped with three brackets
{{{ content }}}
See https://sendgrid.com/docs/ui/sending-email/using-handlebars/ for more information.`;
See https://sendgrid.com/docs/for-developers/sending-email/using-handlebars/ for more information.`;
module.exports = {
DYNAMIC_TEMPLATE_CHAR_WARNING,
DYNAMIC_TEMPLATE_CHAR_WARNING
};
{
"name": "@sendgrid/helpers",
"description": "Twilio SendGrid NodeJS internal helpers",
"version": "6.4.0",
"version": "6.5.0",
"author": "Twilio SendGrid <dx@sendgrid.com> (sendgrid.com)",

@@ -35,3 +35,4 @@ "contributors": [

"deepmerge": "^2.1.1"
}
},
"gitHead": "37473ad95a20258196d7cf256ea391508872d65e"
}
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