@live-change/email-service 0.8.55 → 0.8.57
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 +3 -3
- 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.57",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://www.viamage.com/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/framework": "^0.8.
|
|
24
|
+
"@live-change/framework": "^0.8.57",
|
|
25
25
|
"got": "^11.8.3",
|
|
26
26
|
"html-to-text": "8.1.0",
|
|
27
27
|
"inline-css": "4.0.2",
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"juice": "9.1.0",
|
|
30
30
|
"nodemailer": "^6.7.2"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "0539a68440ef94277492b0206ba779ff16967086",
|
|
33
33
|
"type": "module"
|
|
34
34
|
}
|
package/render.js
CHANGED
|
@@ -82,6 +82,14 @@ 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,
|
|
@@ -97,12 +105,9 @@ async function renderEmail(data) {
|
|
|
97
105
|
else resolve(html)
|
|
98
106
|
})
|
|
99
107
|
})
|
|
100
|
-
//console.log("HTML", body)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
console.log("RENDER EMAIL HEADERS JSON:", headersJson)
|
|
104
|
-
const headers = JSON.parse(headersJson)
|
|
105
|
-
console.log("PARSED HEADERS", headers)
|
|
108
|
+
//console.log("RENDER EMAIL HTML", body)
|
|
109
|
+
dom = new JSDOM(body)
|
|
110
|
+
|
|
106
111
|
const messageElements = dom.window.document.querySelectorAll("[data-html],[data-text]")
|
|
107
112
|
const email = { ...headers }
|
|
108
113
|
const images = new Map()
|