@live-change/email-service 0.9.196 → 0.9.198

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.
Files changed (3) hide show
  1. package/config.js +2 -6
  2. package/package.json +3 -3
  3. package/render.js +3 -4
package/config.js CHANGED
@@ -40,7 +40,7 @@ const smtp = {
40
40
  ignoreTLS: getValue(definition.config.smtp?.ignoreTLS, undefined),
41
41
  }
42
42
 
43
- const renderMethod = getValue(definition.config.renderMethod, process.env.EMAIL_RENDER_METHOD, 'juice')
43
+ const renderMethod = getValue(definition.config.renderMethod, process.env.EMAIL_RENDER_METHOD, 'browser')
44
44
 
45
45
  definition.clientConfig = {}
46
46
 
@@ -53,11 +53,7 @@ const config = {
53
53
  browser,
54
54
  smtp,
55
55
  renderMethod,
56
- ssrUrl: getValue(
57
- definition.config.browser?.ssrUrl,
58
- process.env.SSR_URL,
59
- 'http://localhost:8001'
60
- ),
56
+ ssrUrl: definition.config.browser?.ssrUrl,
61
57
  userEmailsReaderRoles,
62
58
  userEmailsWriterRoles,
63
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/email-service",
3
- "version": "0.9.196",
3
+ "version": "0.9.198",
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.9.196",
24
+ "@live-change/framework": "^0.9.198",
25
25
  "got": "^11.8.6",
26
26
  "html-to-text": "8.1.0",
27
27
  "inline-css": "4.0.2",
@@ -32,6 +32,6 @@
32
32
  "postcss-calc": "10.1.1",
33
33
  "postcss-custom-properties": "14.0.4"
34
34
  },
35
- "gitHead": "7f358a1cc16fb35069f6ce3f897412232f766843",
35
+ "gitHead": "7e485dcbaa2af7fb17052a40238210dc8bdf0c09",
36
36
  "type": "module"
37
37
  }
package/render.js CHANGED
@@ -79,7 +79,6 @@ function processElement(element, images) {
79
79
  async function renderEmailWithJuice(url) {
80
80
  const response = await got(url)
81
81
  let body = response.body
82
- console.log("BASE URL", baseUrl)
83
82
 
84
83
  let dom = new JSDOM(body)
85
84
  //console.log("RENDER EMAIL HEADERS HTML:", dom.window.document.querySelector('[data-headers]').innerHTML)
@@ -407,13 +406,13 @@ async function renderEmailWithBrowser(url) {
407
406
  email.html = dom.serialize()
408
407
  dom.window.close()
409
408
 
410
- console.log("IMAGES", Array.from(images.entries()))
409
+ //console.log("IMAGES", Array.from(images.entries()))
411
410
  const imageAttachments = await processImageAttachments(images, url)
412
411
 
413
412
  email.attachments = email.attachments || []
414
413
  email.attachments.push(...imageAttachments)
415
414
 
416
- console.log("EMAIL", email)
415
+ //console.log("EMAIL", email)
417
416
 
418
417
  return email
419
418
  }
@@ -422,7 +421,7 @@ export { renderEmailWithJuice, renderEmailWithBrowser }
422
421
 
423
422
  async function renderEmail(data) {
424
423
  console.log("RENDER EMAIL WITH CONFIG", config)
425
- const baseUrl = config.ssrUrl
424
+ const baseUrl = config.ssrUrl || process.env.SSR_URL || 'http://localhost:8001'
426
425
 
427
426
  const encodedData = encodeURIComponent(JSON.stringify(data))
428
427
  const url = `${baseUrl}/_email/${data.action}/${data.contact}/${encodedData}`