backend-manager 5.0.184 → 5.0.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
14
14
|
- `Fixed` for any bug fixes.
|
|
15
15
|
- `Security` in case of vulnerabilities.
|
|
16
16
|
|
|
17
|
+
# [5.0.185] - 2026-04-01
|
|
18
|
+
### Changed
|
|
19
|
+
- Use `_.merge` for dynamic template data so callers can override any nested field (e.g. `email.preview`, `personalization.name`, `data.body.*`)
|
|
20
|
+
- Set email schema `template` default to `'default'` instead of `undefined`
|
|
21
|
+
|
|
17
22
|
# [5.0.184] - 2026-03-31
|
|
18
23
|
### Changed
|
|
19
24
|
- Renamed email template shortcuts from `main/` to `core/` prefix across constants and all consumer files
|
package/package.json
CHANGED
|
@@ -212,31 +212,36 @@ Transactional.prototype.build = async function (settings) {
|
|
|
212
212
|
settings.data.email.body = tagLinks(settings.data.email.body, utmOptions);
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
// Build dynamic template data
|
|
215
|
+
// Build dynamic template data defaults
|
|
216
216
|
const dynamicTemplateData = {
|
|
217
217
|
email: {
|
|
218
218
|
id: Manager.require('uuid').v4(),
|
|
219
|
-
subject
|
|
220
|
-
preview:
|
|
221
|
-
body:
|
|
219
|
+
subject,
|
|
220
|
+
preview: null,
|
|
221
|
+
body: null,
|
|
222
222
|
unsubscribeUrl,
|
|
223
223
|
categories,
|
|
224
224
|
footer: {
|
|
225
|
-
text:
|
|
225
|
+
text: null,
|
|
226
226
|
},
|
|
227
227
|
carbonCopy: copy,
|
|
228
228
|
},
|
|
229
229
|
personalization: {
|
|
230
230
|
email: to[0].email,
|
|
231
231
|
name: to[0].name,
|
|
232
|
-
...settings?.data?.personalization,
|
|
233
232
|
},
|
|
234
233
|
signoff,
|
|
235
234
|
brand: brandData,
|
|
236
235
|
user: userProperties,
|
|
237
|
-
data:
|
|
236
|
+
data: {},
|
|
238
237
|
};
|
|
239
238
|
|
|
239
|
+
// Deep-merge caller's data on top so they can override any field
|
|
240
|
+
// (e.g. email.preview, email.subject, personalization.name, data.body.*, etc.)
|
|
241
|
+
if (settings.data) {
|
|
242
|
+
_.merge(dynamicTemplateData, settings.data);
|
|
243
|
+
}
|
|
244
|
+
|
|
240
245
|
// Build the email object
|
|
241
246
|
const email = {
|
|
242
247
|
to,
|
|
@@ -15,7 +15,7 @@ module.exports = () => ({
|
|
|
15
15
|
replyTo: { types: ['string'], default: undefined },
|
|
16
16
|
sender: { types: ['string'], default: undefined },
|
|
17
17
|
subject: { types: ['string'], default: undefined },
|
|
18
|
-
template: { types: ['string'], default:
|
|
18
|
+
template: { types: ['string'], default: 'default' },
|
|
19
19
|
group: { types: ['number', 'string'], default: undefined },
|
|
20
20
|
sendAt: { types: ['number', 'string'], default: undefined },
|
|
21
21
|
data: { types: ['object'], default: {} },
|