@live-change/email-service 0.8.56 → 0.8.58
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/package.json +4 -4
- package/render.js +11 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/email-service",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.58",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"url": "https://www.viamage.com/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/framework": "^0.8.
|
|
24
|
+
"@live-change/framework": "^0.8.58",
|
|
25
25
|
"got": "^11.8.3",
|
|
26
26
|
"html-to-text": "8.1.0",
|
|
27
27
|
"inline-css": "4.0.2",
|
|
28
28
|
"jsdom": "^24.1.0",
|
|
29
|
-
"juice": "
|
|
29
|
+
"juice": "11.0.0",
|
|
30
30
|
"nodemailer": "^6.7.2"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "bd44582e1eaa6396a4a24daabc945c0866ed8657",
|
|
33
33
|
"type": "module"
|
|
34
34
|
}
|
package/render.js
CHANGED
|
@@ -82,11 +82,20 @@ async function renderEmail(data) {
|
|
|
82
82
|
const response = await got(url)
|
|
83
83
|
let body = response.body
|
|
84
84
|
console.log("BASE URL", baseUrl)
|
|
85
|
+
|
|
86
|
+
let dom = new JSDOM(body)
|
|
87
|
+
//console.log("RENDER EMAIL HEADERS HTML:", dom.window.document.querySelector('[data-headers]').innerHTML)
|
|
88
|
+
const headersJson = dom.window.document.querySelector('[data-headers]').textContent
|
|
89
|
+
//console.log("RENDER EMAIL HEADERS JSON:", headersJson)
|
|
90
|
+
const headers = JSON.parse(headersJson)
|
|
91
|
+
//console.log("PARSED HEADERS", headers)
|
|
92
|
+
|
|
85
93
|
const juiceOptions = {
|
|
86
94
|
webResources: {
|
|
87
95
|
scripts: false,
|
|
88
96
|
links: true,
|
|
89
97
|
images: false,
|
|
98
|
+
resolveCSSVariables: true,
|
|
90
99
|
relativeTo: url
|
|
91
100
|
}
|
|
92
101
|
}
|
|
@@ -98,12 +107,8 @@ async function renderEmail(data) {
|
|
|
98
107
|
})
|
|
99
108
|
})
|
|
100
109
|
//console.log("RENDER EMAIL HTML", body)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const headersJson = dom.window.document.querySelector('[data-headers]').textContent
|
|
104
|
-
console.log("RENDER EMAIL HEADERS JSON:", headersJson)
|
|
105
|
-
const headers = JSON.parse(headersJson)
|
|
106
|
-
console.log("PARSED HEADERS", headers)
|
|
110
|
+
dom = new JSDOM(body)
|
|
111
|
+
|
|
107
112
|
const messageElements = dom.window.document.querySelectorAll("[data-html],[data-text]")
|
|
108
113
|
const email = { ...headers }
|
|
109
114
|
const images = new Map()
|