@sendgrid/helpers
Advanced tools
Comparing version 6.0.0-beta.2 to 6.0.0-beta.3
@@ -58,6 +58,6 @@ 'use strict'; | ||
const { | ||
to, from, replyTo, sendAt, subject, text, html, content, templateId, | ||
personalizations, attachments, ipPoolName, batchId, asm, sections, | ||
headers, categories, customArgs, mailSettings, trackingSettings, | ||
substitutions, substitutionWrappers, isMultiple, | ||
to, from, replyTo, cc, bcc, sendAt, subject, text, html, content, | ||
templateId, personalizations, attachments, ipPoolName, batchId, | ||
sections, headers, categories, customArgs, asm, mailSettings, | ||
trackingSettings, substitutions, substitutionWrappers, isMultiple, | ||
} = data; | ||
@@ -91,7 +91,18 @@ | ||
//Create base data for personalizations | ||
const baseData = { | ||
cc, | ||
bcc, | ||
substitutions, | ||
substitutionWrappers, | ||
}; | ||
//Multiple individual emails | ||
if (isMultiple && Array.isArray(to)) { | ||
to.forEach(to => { | ||
const subs = to.substitutions || substitutions; | ||
this.addTo(to, subs, substitutionWrappers); | ||
const toData = Object.assign({}, baseData, {to}); | ||
if (to.substitutions) { | ||
toData.substitutions = to.substitutions; | ||
} | ||
this.addTo(toData); | ||
}); | ||
@@ -102,3 +113,4 @@ } | ||
else { | ||
this.addTo(to, substitutions, substitutionWrappers); | ||
const toData = Object.assign({}, baseData, {to}); | ||
this.addTo(toData); | ||
} | ||
@@ -229,6 +241,4 @@ } | ||
*/ | ||
addTo(to, substitutions, substitutionWrappers) { | ||
this.addPersonalization(new Personalization({ | ||
to, substitutions, substitutionWrappers, | ||
})); | ||
addTo(data) { | ||
this.addPersonalization(new Personalization(data)); | ||
} | ||
@@ -235,0 +245,0 @@ |
{ | ||
"name": "@sendgrid/helpers", | ||
"description": "SendGrid NodeJS internal helpers", | ||
"version": "6.0.0-beta.2", | ||
"version": "6.0.0-beta.3", | ||
"author": "SendGrid <dx@sendgrid.com> (sendgrid.com)", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41333
1548