email-builder-utils 1.1.2 → 1.1.3

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.
@@ -11,48 +11,48 @@ const convertJsonToHtml = async (jsonData) => {
11
11
  (rootData.style?.padding?.left || 0) -
12
12
  (rootData.style?.padding?.right || 0)));
13
13
  }
14
- const rawHtml = `
15
- <!DOCTYPE html>
16
- <html lang="en">
17
- <head>
18
- <meta charset="UTF-8" />
19
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
20
- <title>Email Layout</title>
21
- <style>
22
- .responsive-table {
23
- width: 100%;
24
- max-width: 600px;
25
- }
26
-
27
- @media only screen and (max-width: 600px) {
28
- .stack-column {
29
- display: block !important;
30
- width: 100% !important;
31
- max-width: 100% !important;
32
- }
33
- }
34
- </style>
35
- </head>
36
- <body>
37
- <center>
38
- <table
39
- class="responsive-table"
40
- style="font-family: ${rootData.style?.fontFamily};
41
- margin: 0 auto;
42
- background-color: ${rootData.style?.canvasColor};
43
- color: ${rootData.style?.textColor};
44
- ${jsonToHTML_1.tableCommonStyle}"
45
- >
46
- <tbody>
47
- <tr>
48
- <td style="padding: 0;">
49
- ${blocksHtml.join("")}
50
- </td>
51
- </tr>
52
- </tbody>
53
- </table>
54
- </center>
55
- </body>
14
+ const rawHtml = `
15
+ <!DOCTYPE html>
16
+ <html lang="en">
17
+ <head>
18
+ <meta charset="UTF-8" />
19
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
20
+ <title>Email Layout</title>
21
+ <style>
22
+ .responsive-table {
23
+ width: 100%;
24
+ max-width: 600px;
25
+ }
26
+
27
+ @media only screen and (max-width: 600px) {
28
+ .stack-column {
29
+ display: block !important;
30
+ width: 100% !important;
31
+ max-width: 100% !important;
32
+ }
33
+ }
34
+ </style>
35
+ </head>
36
+ <body>
37
+ <center>
38
+ <table
39
+ class="responsive-table"
40
+ style="font-family: ${rootData.style?.fontFamily};
41
+ margin: 0 auto;
42
+ background-color: ${rootData.style?.canvasColor};
43
+ color: ${rootData.style?.textColor};
44
+ ${jsonToHTML_1.tableCommonStyle}"
45
+ >
46
+ <tbody>
47
+ <tr>
48
+ <td style="padding: 0;">
49
+ ${blocksHtml.join("")}
50
+ </td>
51
+ </tr>
52
+ </tbody>
53
+ </table>
54
+ </center>
55
+ </body>
56
56
  </html>`;
57
57
  return rawHtml;
58
58
  };
@@ -71,8 +71,8 @@ async function convertToHtml(blockData, rootData, cellWidthInPx) {
71
71
  }
72
72
  }
73
73
  function appendOutlookSupport(content, contentStyle) {
74
- return `
75
- <table width="100%" style="${exports.tableCommonStyle}"><tr><td style="${contentStyle}">${content}</td></tr></table>
74
+ return `
75
+ <table width="100%" style="${exports.tableCommonStyle}"><tr><td style="${contentStyle}">${content}</td></tr></table>
76
76
  `;
77
77
  }
78
78
  function convertDividerBlockToHtml(blockData) {
@@ -113,22 +113,22 @@ async function appendOutlookForImage(content, outerContainerWidth, innerContaine
113
113
  const borderAttributes = borderWidth > 0
114
114
  ? `strokeweight="${borderWidth}px" strokecolor="${borderColor}"`
115
115
  : `stroked="false"`;
116
- const outlookImage = `<!--[if mso]>
117
- <v:${useRoundRect ? "roundrect" : "rect"} xmlns:v="urn:schemas-microsoft-com:vml"
118
- style="width:${scaledWidth}px;height:${scaledHeight}px;"
119
- ${borderAttributes}
120
- ${useRoundRect ? `arcsize="${arcsize}"` : ""}
121
- fill="true"
122
- fillcolor="none">
123
- <v:fill src="${imageUrl}" type="frame" />
124
- <v:textbox inset="0,0,0,0"><div style="display:none;">.</div></v:textbox>
125
- </v:${useRoundRect ? "roundrect" : "rect"}>
116
+ const outlookImage = `<!--[if mso]>
117
+ <v:${useRoundRect ? "roundrect" : "rect"} xmlns:v="urn:schemas-microsoft-com:vml"
118
+ style="width:${scaledWidth}px;height:${scaledHeight}px;"
119
+ ${borderAttributes}
120
+ ${useRoundRect ? `arcsize="${arcsize}"` : ""}
121
+ fill="true"
122
+ fillcolor="none">
123
+ <v:fill src="${imageUrl}" type="frame" />
124
+ <v:textbox inset="0,0,0,0"><div style="display:none;">.</div></v:textbox>
125
+ </v:${useRoundRect ? "roundrect" : "rect"}>
126
126
  <![endif]-->`;
127
- return `
128
- ${outlookImage}
129
- <!--[if !mso]><!-->
130
- ${content}
131
- <!--<![endif]-->
127
+ return `
128
+ ${outlookImage}
129
+ <!--[if !mso]><!-->
130
+ ${content}
131
+ <!--<![endif]-->
132
132
  `;
133
133
  }
134
134
  async function convertImageBlock(blockData, cellWidthInPx) {
@@ -147,18 +147,18 @@ async function convertImageBlock(blockData, cellWidthInPx) {
147
147
  }
148
148
  function appendOutlookForButton(content, buttonStyle, navigateToUrl, text) {
149
149
  const { width, buttonColor, borderColor, borderRadius, borderWidth, height, buttonPadding, color, fontFamily, fontSize, fontWeight } = buttonStyle;
150
- return `
151
- <!--[if mso]>
152
- <v:${borderRadius ? "roundrect" : "rect"} xmlns:v="urn:schemas-microsoft-com:vml" href="${navigateToUrl}" xmlns:w="urn:schemas-microsoft-com:office:word" style="height:${height || 44}px;width:${width || 200}px;v-text-anchor:middle;" arcsize="${borderRadius || 0}px" strokeweight="${borderWidth || 0}px" strokecolor="${borderColor || "transparent"}" fillcolor="${buttonColor || "none"}">
153
- <w:anchorlock/>
154
- <v:textbox inset="${buttonPadding?.top || 0}px, ${buttonPadding?.left || 0}px, ${buttonPadding?.bottom || 0}px, ${buttonPadding?.right || 0}px">
155
- <center style="font-family:${fontFamily || ""};font-size:${fontSize}px;font-weight:${fontWeight};color:${color};">${text}</center>
156
- </v:textbox>
157
- </v:${borderRadius ? "roundrect" : "rect"}>
158
- <![endif]-->
159
- <!--[if !mso]><!-->
160
- ${content}
161
- <!--<![endif]-->
150
+ return `
151
+ <!--[if mso]>
152
+ <v:${borderRadius ? "roundrect" : "rect"} xmlns:v="urn:schemas-microsoft-com:vml" href="${navigateToUrl}" xmlns:w="urn:schemas-microsoft-com:office:word" style="height:${height || 44}px;width:${width || 200}px;v-text-anchor:middle;" arcsize="${borderRadius || 0}px" strokeweight="${borderWidth || 0}px" strokecolor="${borderColor || "transparent"}" fillcolor="${buttonColor || "none"}">
153
+ <w:anchorlock/>
154
+ <v:textbox inset="${buttonPadding?.top || 0}px, ${buttonPadding?.left || 0}px, ${buttonPadding?.bottom || 0}px, ${buttonPadding?.right || 0}px">
155
+ <center style="font-family:${fontFamily || ""};font-size:${fontSize}px;font-weight:${fontWeight};color:${color};">${text}</center>
156
+ </v:textbox>
157
+ </v:${borderRadius ? "roundrect" : "rect"}>
158
+ <![endif]-->
159
+ <!--[if !mso]><!-->
160
+ ${content}
161
+ <!--<![endif]-->
162
162
  `;
163
163
  }
164
164
  function convertButtonBlock(blockData) {
@@ -205,12 +205,12 @@ async function convertGridBlock(blockData, rootData, cellWidthInPx) {
205
205
  const { rows, columns, cellWidths } = props;
206
206
  const styles = buildStyles(rest, { perChanges: [], pxChanges: allPxAttributes });
207
207
  const gridItems = await processGridItemsInParallel(columns, childrenIds, cellWidths, cellWidthInPx, rootData);
208
- return `
209
- <table cellspacing="${columnGap}" style="width:100%; max-width:100%; ${styles}">
210
- <tbody>
211
- <tr>${gridItems.join("")}</tr>
212
- </tbody>
213
- </table>
208
+ return `
209
+ <table cellspacing="${columnGap}" style="width:100%; max-width:100%; ${styles}">
210
+ <tbody>
211
+ <tr>${gridItems.join("")}</tr>
212
+ </tbody>
213
+ </table>
214
214
  `;
215
215
  }
216
216
  async function convertGridCellBlock(blockData, rootData, cellWidth, parentCellWidth) {
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "name": "email-builder-utils",
3
- "version": "1.1.2",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "files": [
7
- "dist"
8
- ],
9
- "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1",
11
- "build": "tsc",
12
- "start": "npm run build && node dist/index.js"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://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@github.com/Biztecno-Infra/email-builder-utils.git"
17
- },
18
- "author": "",
19
- "license": "ISC",
20
- "bugs": {
21
- "url": "https://github.com/Biztecno-Infra/email-builder-utils/issues"
22
- },
23
- "homepage": "https://github.com/Biztecno-Infra/email-builder-utils#readme",
24
- "description": "",
25
- "devDependencies": {
26
- "@types/node": "^22.13.10",
27
- "@types/pngjs": "^6.0.5",
28
- "typescript": "^5.8.2"
29
- },
30
- "dependencies": {
31
- "jimp": "^1.6.0"
32
- }
33
- }
1
+ {
2
+ "name": "email-builder-utils",
3
+ "version": "1.1.3",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "build": "tsc",
12
+ "start": "npm run build && node dist/index.js"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://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@github.com/Biztecno-Infra/email-builder-utils.git"
17
+ },
18
+ "author": "",
19
+ "license": "ISC",
20
+ "bugs": {
21
+ "url": "https://github.com/Biztecno-Infra/email-builder-utils/issues"
22
+ },
23
+ "homepage": "https://github.com/Biztecno-Infra/email-builder-utils#readme",
24
+ "description": "",
25
+ "devDependencies": {
26
+ "@types/node": "^22.13.10",
27
+ "@types/pngjs": "^6.0.5",
28
+ "typescript": "^5.8.2"
29
+ },
30
+ "dependencies": {
31
+ "jimp": "^1.6.0"
32
+ }
33
+ }