email-builder-utils 1.0.11 → 1.0.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"jsonToHTML.d.ts","sourceRoot":"","sources":["../../src/utils/jsonToHTML.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AASrC,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc,CAAC;QACtB,KAAK,EAAE,GAAG,CAAC;QACX,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KAC7B,CAAC;CACH;AASD,eAAO,MAAM,gBAAgB,kDAAkD,CAAC;AAqDhF,wBAAsB,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,mBAiB9F"}
1
+ {"version":3,"file":"jsonToHTML.d.ts","sourceRoot":"","sources":["../../src/utils/jsonToHTML.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AASrC,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc,CAAC;QACtB,KAAK,EAAE,GAAG,CAAC;QACX,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KAC7B,CAAC;CACH;AASD,eAAO,MAAM,gBAAgB,kDAAkD,CAAC;AAyDhF,wBAAsB,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,mBAiB9F"}
@@ -29,8 +29,14 @@ function jsonToPlainString(obj) {
29
29
  .join("");
30
30
  }
31
31
  function buildStyles(style, { pxChanges, perChanges }) {
32
+ if (!style) {
33
+ style = {};
34
+ }
32
35
  const stylesObj = {};
33
36
  Object.entries(style).forEach(([key, value]) => {
37
+ if (key === "customCss") {
38
+ return;
39
+ }
34
40
  const appendPx = pxChanges.includes(key);
35
41
  const appendPer = perChanges.includes(key);
36
42
  if (value === undefined || value === null || value === "")
@@ -51,7 +57,7 @@ function buildStyles(style, { pxChanges, perChanges }) {
51
57
  }
52
58
  return;
53
59
  });
54
- return jsonToPlainString(cleanJson(stylesObj)).trim();
60
+ return `${jsonToPlainString(cleanJson(stylesObj))}${style.customCss || ""}`.trim();
55
61
  }
56
62
  async function convertToHtml(blockData, rootData, cellWidthInPx) {
57
63
  switch (blockData.type) {
@@ -106,7 +112,7 @@ async function appendOutlookForImage(content, outerContainerWidth, innerContaine
106
112
  const scaledHeight = Math.round(originalHeight * widthScalingFactor); // Maintain aspect ratio
107
113
  // VML for Outlook
108
114
  const outlookImage = `<!--[if mso]>
109
- <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="t" stroke="f" style="width:${scaledWidth}px;height:${scaledHeight}px;">
115
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" style="width:${scaledWidth}px;height:${scaledHeight}px;">
110
116
  <v:fill src="${imageUrl}" type="frame" />
111
117
  </v:rect>
112
118
  <![endif]-->`;
@@ -148,8 +154,10 @@ function appendOutlookForButton(content, buttonStyle, navigateToUrl, text) {
148
154
  function convertButtonBlock(blockData) {
149
155
  const { style, props } = blockData.data;
150
156
  const { text, navigateToUrl } = props;
151
- const { fontFamily, fontSize, fontWeight, borderColor, borderRadius, borderWidth, borderStyle, buttonPadding, textColor, buttonColor, ...rest } = style;
157
+ const { fontFamily, fontSize, fontWeight, borderColor, borderRadius, borderWidth, borderStyle, buttonPadding, textColor, buttonColor, width, height, ...rest } = style;
152
158
  const buttonStyle = {
159
+ width,
160
+ height,
153
161
  fontFamily,
154
162
  fontSize,
155
163
  fontWeight,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "email-builder-utils",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [