email-builder-utils 1.1.47 → 1.1.48

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":"button.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/button.ts"],"names":[],"mappings":"AAYA,wBAAgB,sBAAsB,CAAC,UAAU,EAAE;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;EA6ErG;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,UAgEhD"}
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/button.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,CAAC,UAAU,EAAE;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;EA6ErG;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,UAgEhD"}
@@ -5,13 +5,6 @@ exports.convertButtonBlock = convertButtonBlock;
5
5
  const buildStyles_1 = require("../buildStyles");
6
6
  const fontFallback_1 = require("../fontFallback");
7
7
  const common_1 = require("../common");
8
- function encodeBlockPropsAttr(props) {
9
- return JSON.stringify(props)
10
- .replace(/&/g, "&")
11
- .replace(/"/g, """)
12
- .replace(/</g, "&lt;")
13
- .replace(/>/g, "&gt;");
14
- }
15
8
  function appendOutlookForButton(buttonData) {
16
9
  const { style, text, navigateToUrl } = buttonData;
17
10
  const pad = style.buttonPadding || {};
@@ -93,7 +86,7 @@ function convertButtonBlock(blockData) {
93
86
  text: text || "",
94
87
  navigateToUrl: navigateToUrl || "",
95
88
  });
96
- const buttonBlockProps = encodeBlockPropsAttr({
89
+ const buttonBlockProps = (0, common_1.encodeBlockPropsAttr)({
97
90
  buttonText: text || "",
98
91
  navigateToUrl: navigateToUrl || "",
99
92
  buttonColor: computed.bgColor,
@@ -1 +1 @@
1
- {"version":3,"file":"dividers.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/dividers.ts"],"names":[],"mappings":"AAIA,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,GAAG,UAuCvD;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,GAAG,UAKtD;AAED,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,GAAG,UAuB/D"}
1
+ {"version":3,"file":"dividers.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/dividers.ts"],"names":[],"mappings":"AAIA,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,GAAG,UAuCvD;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,GAAG,UAKtD;AAED,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,GAAG,UAwB/D"}
@@ -52,11 +52,12 @@ function convertVerticalDividerBlockToHtml(blockData) {
52
52
  const { width, height, dividerColor, padding, backgroundColor } = style;
53
53
  const visibilityClass = (0, common_1.getVisibilityClass)(props);
54
54
  const outerStyles = (0, buildStyles_1.buildStyles)({ padding, backgroundColor }, {
55
- perChanges: [], pxChanges: buildStyles_1.allPxAttributes,
55
+ perChanges: [],
56
+ pxChanges: buildStyles_1.allPxAttributes,
56
57
  });
57
58
  return `
58
59
  <table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation"
59
- style="${buildStyles_1.tableCommonStyle}; max-width:600px;" class="${visibilityClass}">
60
+ style="${buildStyles_1.tableCommonStyle}; max-width:600px;" class="${visibilityClass}" data-block-type="vdivider">
60
61
  <tr>
61
62
  <td style="${outerStyles}; text-align:center; vertical-align:middle;">
62
63
  <!--[if mso | IE]>
@@ -1 +1 @@
1
- {"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/shape.ts"],"names":[],"mappings":"AAuHA,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,GAAG,mBAyHrD"}
1
+ {"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/shape.ts"],"names":[],"mappings":"AAuHA,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,GAAG,mBA2MrD"}
@@ -100,11 +100,19 @@ async function convertShapeBlock(blockData) {
100
100
  const visibilityClass = (0, common_1.getVisibilityClass)(props);
101
101
  const { width = "100", height = "150", padding = {}, backgroundColor = "#2F80ED", borderRadius, borderWidth = 0, borderStyle = "solid", borderColor = "transparent", customCss, shapeColor, alignment = "left", msoBakeImageWithText, color = "#000000", fontSize = 14, textAlign = "center", verticalAlign = "middle", } = style || {};
102
102
  const borderRadiusMap = {
103
- rectangle: "0", rounded: "10px", circle: "50%", oval: "50%",
103
+ rectangle: "0",
104
+ rounded: "10px",
105
+ circle: "50%",
106
+ oval: "50%",
104
107
  };
105
108
  let resolvedBorderRadius = borderRadius || borderRadiusMap[shape] || "0";
106
- let resolvedWidthPx = typeof width === "number" ? width : parseInt(width.toString().replace("px", ""), 10) || 100;
107
- let resolvedHeightPx = typeof height === "number" ? height : parseInt(height.toString().replace("px", ""), 10) || 150;
109
+ let resolvedWidthPx = typeof width === "number"
110
+ ? width
111
+ : parseInt(width.toString().replace("px", ""), 10) || 100;
112
+ let resolvedHeightPx = typeof height === "number"
113
+ ? height
114
+ : parseInt(height.toString().replace("px", ""), 10) || 150;
115
+ // --- Shape-specific constraints ---
108
116
  if (shape === "circle") {
109
117
  const side = Math.min(resolvedWidthPx, resolvedHeightPx);
110
118
  resolvedWidthPx = side;
@@ -115,16 +123,28 @@ async function convertShapeBlock(blockData) {
115
123
  resolvedBorderRadius = "50% / 50%";
116
124
  }
117
125
  const finalBackgroundColor = shapeColor || backgroundColor;
126
+ // --- Horizontal alignment for outer container ---
118
127
  const alignmentStyles = {
119
128
  left: "margin-right:auto;margin-left:0;",
120
129
  center: "margin-left:auto;margin-right:auto;",
121
130
  right: "margin-left:auto;margin-right:0;",
122
131
  };
123
132
  const alignmentStyle = alignmentStyles[alignment] || "";
124
- const textAlignMap = { left: "left", center: "center", right: "right", justify: "justify" };
133
+ // --- Text + vertical alignment maps ---
134
+ const textAlignMap = {
135
+ left: "left",
136
+ center: "center",
137
+ right: "right",
138
+ justify: "justify",
139
+ };
125
140
  const textAlignStyle = textAlignMap[textAlign] || "center";
141
+ // --- Text styling ---
126
142
  const textSizeStyle = `font-size:${fontSize}px;line-height:1.3;word-break:break-word;overflow-wrap:break-word;color:${color};`;
143
+ // ============================
144
+ // Modern HTML (non-MSO)
145
+ // ============================
127
146
  let nonMsoContent = "";
147
+ // --- Case 1: Image + Text ---
128
148
  if (imageUrl && text) {
129
149
  nonMsoContent = `
130
150
  <div style="display:inline-block;width:${resolvedWidthPx}px;height:${resolvedHeightPx}px;
@@ -148,6 +168,7 @@ async function convertShapeBlock(blockData) {
148
168
  </table>
149
169
  </div>`;
150
170
  }
171
+ // --- Case 2: Image only ---
151
172
  else if (imageUrl) {
152
173
  nonMsoContent = `
153
174
  <div style="display:inline-block;width:${resolvedWidthPx}px;height:${resolvedHeightPx}px;
@@ -159,6 +180,7 @@ async function convertShapeBlock(blockData) {
159
180
  style="width:100%;height:100%;object-fit:cover;border-radius:${resolvedBorderRadius};display:block;" />
160
181
  </div>`;
161
182
  }
183
+ // --- Case 3: Text only ---
162
184
  else {
163
185
  nonMsoContent = `
164
186
  <div style="display:inline-block;width:${resolvedWidthPx}px;height:${resolvedHeightPx}px;
@@ -178,15 +200,50 @@ async function convertShapeBlock(blockData) {
178
200
  </table>
179
201
  </div>`;
180
202
  }
203
+ // Outlook (VML) fallback
181
204
  const outlookContent = appendOutlookForShape(nonMsoContent, resolvedWidthPx, resolvedWidthPx, {
182
- shape, imageUrl, backgroundColor, shapeColor,
183
- borderWidth, borderColor, borderRadius: resolvedBorderRadius,
184
- heightPx: resolvedHeightPx, text, textColor: color,
185
- textSize: fontSize, verticalAlign, textAlign, alignment,
186
- padding, msoBakeImageWithText,
205
+ shape,
206
+ imageUrl,
207
+ backgroundColor,
208
+ shapeColor,
209
+ borderWidth,
210
+ borderColor,
211
+ borderRadius: resolvedBorderRadius,
212
+ heightPx: resolvedHeightPx,
213
+ text,
214
+ textColor: color,
215
+ textSize: fontSize,
216
+ verticalAlign,
217
+ textAlign, // ✅ added
218
+ alignment,
219
+ padding,
220
+ msoBakeImageWithText,
187
221
  }, visibilityClass);
222
+ const shapeBlockProps = (0, common_1.encodeBlockPropsAttr)({
223
+ shape: shape || 'rectangle',
224
+ width: resolvedWidthPx,
225
+ height: resolvedHeightPx,
226
+ shapeColor: shapeColor || '',
227
+ backgroundColor: backgroundColor || '',
228
+ borderRadius: resolvedBorderRadius,
229
+ borderWidth,
230
+ borderColor,
231
+ borderStyle,
232
+ imageUrl: imageUrl || '',
233
+ text: text || '',
234
+ color,
235
+ fontSize,
236
+ textAlign,
237
+ verticalAlign,
238
+ alignment,
239
+ padding,
240
+ customCss: customCss || '',
241
+ hideOnDesktop: Boolean(props.hideOnDesktop),
242
+ hideOnMobile: Boolean(props.hideOnMobile),
243
+ });
244
+ // Combine into table wrapper
188
245
  return `
189
- <table width="100%" style="border-collapse:collapse;table-layout:fixed;max-width:600px;" class="${visibilityClass}">
246
+ <table width="100%" style="border-collapse:collapse;table-layout:fixed;max-width:600px;" class="${visibilityClass}" data-block-type="shape" data-block-props="${shapeBlockProps}">
190
247
  <tr>
191
248
  <td style="padding:${padding.top || 0}px ${padding.right || 0}px ${padding.bottom || 0}px ${padding.left || 0}px;text-align:${alignment};">
192
249
  ${outlookContent}
@@ -1 +1 @@
1
- {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/video.ts"],"names":[],"mappings":"AAUA,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,mBA0H5E"}
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/video.ts"],"names":[],"mappings":"AAUA,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,GAAG,EACd,aAAa,EAAE,MAAM,mBAiKtB"}
@@ -30,6 +30,7 @@ async function convertVideoBlock(blockData, cellWidthInPx) {
30
30
  catch (_) { }
31
31
  }
32
32
  }
33
+ // Width / dimensions
33
34
  let percentWidth = '100%';
34
35
  if (typeof style?.width === 'string' && style.width.trim().endsWith('%')) {
35
36
  percentWidth = style.width.trim();
@@ -42,24 +43,51 @@ async function convertVideoBlock(blockData, cellWidthInPx) {
42
43
  const innerContainerWidth = (parseFloat(percentWidth) / 100) * (cellWidthInPx - paddingLeft - paddingRight);
43
44
  const thumbnailW = Math.round(innerContainerWidth);
44
45
  const thumbnailH = Math.round(thumbnailW / (16 / 9));
46
+ // Border
45
47
  const borderRadius = parseInt(style?.borderRadius || 0);
46
48
  const borderWidth = parseInt(style?.borderWidth || 0);
47
49
  const borderColor = style?.borderColor || 'transparent';
48
50
  const borderStyleProp = style?.borderStyle || 'solid';
49
- const outerContainerStyles = (0, buildStyles_1.buildStyles)({ ...style, width: undefined, borderColor: undefined, borderRadius: undefined, borderWidth: undefined, borderStyle: undefined }, { perChanges: buildStyles_1.addPxOrPerToAttributes, pxChanges: buildStyles_1.addPxToAttributes });
51
+ const outerContainerStyles = (0, buildStyles_1.buildStyles)({
52
+ ...style,
53
+ width: undefined,
54
+ borderColor: undefined,
55
+ borderRadius: undefined,
56
+ borderWidth: undefined,
57
+ borderStyle: undefined,
58
+ }, { perChanges: buildStyles_1.addPxOrPerToAttributes, pxChanges: buildStyles_1.addPxToAttributes });
50
59
  const align = style?.textAlign || 'left';
51
60
  const playIconW = 65;
52
61
  const playIconH = 46;
62
+ // ── Industry-standard VML + background-image table approach ──────────────────
63
+ // Mirrors the pattern used by professional email builders (e.g. Beefree):
64
+ //
65
+ // VML (<!--[if vml]>): all Outlook / Word rendering engine versions.
66
+ // v:group wraps thumbnail (v:rect frame fill) + vector play button
67
+ // (v:oval white circle + v:shape black triangle). No external image needed.
68
+ //
69
+ // Non-VML (<!--[if !vml]>): Gmail, Apple Mail, Yahoo, Outlook.com, EML viewers.
70
+ // thumbnail as `background` attribute + inline background-image on <table>.
71
+ // 3-column layout: [25% spacer GIF] [50% play icon, centred] [25% spacer].
72
+ // The spacer GIF has a 4:9 aspect ratio — when it fills the 25% column its
73
+ // rendered height equals thumbnailWidth × 9/16, keeping the table at 16:9
74
+ // without any fixed `height` CSS (which is stripped by many clients).
75
+ // VML coordinate positions for the play button (in the v:group coord space).
53
76
  const ovalSize = 65;
54
77
  const ovalLeft = Math.round(thumbnailW / 2 - ovalSize / 2);
55
78
  const ovalTop = Math.round(thumbnailH / 2 - ovalSize / 2);
56
79
  const triW = 23;
57
80
  const triH = 33;
81
+ // Triangle centre is slightly right of geometric centre for visual balance.
58
82
  const triLeft = Math.round(thumbnailW / 2 - triW / 2 + 3);
59
83
  const triTop = Math.round(thumbnailH / 2 - triH / 2);
60
- const borderCss = borderWidth > 0 ? `border:${borderWidth}px ${borderStyleProp} ${borderColor};` : '';
84
+ const borderCss = borderWidth > 0
85
+ ? `border:${borderWidth}px ${borderStyleProp} ${borderColor};`
86
+ : '';
61
87
  const radiusCss = borderRadius > 0 ? `border-radius:${borderRadius}px; overflow:hidden;` : '';
88
+ // min-height fallback for clients that ignore the spacer GIF (e.g. some webmail).
62
89
  const minHeight = Math.round(thumbnailW * 0.3);
90
+ // VML block — shown only in Outlook (Word engine supports VML, not standard HTML).
63
91
  const outlookContent = hideOnDesktop ? '' : `<!--[if vml]>
64
92
  <v:group xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word"
65
93
  coordsize="${thumbnailW},${thumbnailH}" coordorigin="0,0"
@@ -76,6 +104,7 @@ async function convertVideoBlock(blockData, cellWidthInPx) {
76
104
  style="position:absolute;left:${triLeft};top:${triTop};width:${triW};height:${triH};" />
77
105
  </v:group>
78
106
  <![endif]-->`;
107
+ // Non-VML block — shown in all clients except Outlook.
79
108
  const nonMsoContent = `<!--[if !vml]><!-->
80
109
  <a href="${videoLink}" target="_blank"
81
110
  style="display:block; text-decoration:none; background-image:url('${resolvedThumbnail}'); background-size:cover; background-position:center; ${borderCss}${radiusCss}">
@@ -101,7 +130,10 @@ async function convertVideoBlock(blockData, cellWidthInPx) {
101
130
  return `
102
131
  <table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation"
103
132
  style="border-collapse:collapse; max-width:600px; margin:0; padding:0;"
104
- class="${visibilityClass}">
133
+ class="${visibilityClass}" data-block-type="video"
134
+ data-video-url="${videoUrl || ''}" data-youtube-url="${youtubeVideoUrl || ''}"
135
+ data-thumbnail-url="${thumbnailUrl || ''}" data-alt-text="${altText || ''}"
136
+ data-width="${typeof style?.width === 'number' ? style.width : 100}">
105
137
  <tr>
106
138
  <td align="${align}" style="${outerContainerStyles}">
107
139
  <table border="0" cellpadding="0" cellspacing="0" role="presentation"
@@ -4,4 +4,5 @@ export declare function getVisibilityClass(props?: {
4
4
  hideOnDesktop?: boolean;
5
5
  hideOnMobile?: boolean;
6
6
  }): string;
7
+ export declare function encodeBlockPropsAttr(props: Record<string, any>): string;
7
8
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAqBvD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAIrD,CAAC;AAGF,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE;IACzC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,UASA"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAqBvD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAIrD,CAAC;AAGF,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE;IACzC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,UASA;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAQvE"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractVimeoId = exports.extractYouTubeId = void 0;
4
4
  exports.getVisibilityClass = getVisibilityClass;
5
+ exports.encodeBlockPropsAttr = encodeBlockPropsAttr;
5
6
  const extractYouTubeId = (url) => {
6
7
  try {
7
8
  const u = new URL(url);
@@ -43,3 +44,12 @@ function getVisibilityClass(props) {
43
44
  .filter(Boolean)
44
45
  .join(" ");
45
46
  }
47
+ function encodeBlockPropsAttr(props) {
48
+ // HTML attribute-safe JSON string.
49
+ // Keep it minimal and deterministic: the importer reads it back via getAttribute + JSON.parse.
50
+ return JSON.stringify(props)
51
+ .replace(/&/g, "&amp;")
52
+ .replace(/"/g, "&quot;")
53
+ .replace(/</g, "&lt;")
54
+ .replace(/>/g, "&gt;");
55
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,GAAU,UAAU,GAAG,oBAwHpD,CAAC"}
1
+ {"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,GAAU,UAAU,GAAG,oBAqLpD,CAAC"}
@@ -20,6 +20,7 @@ const convertJsonToHtml = async (jsonData) => {
20
20
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
21
21
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
22
22
  <meta name="x-apple-disable-message-reformatting" />
23
+ <meta name="format-detection" content="telephone=no,address=no,email=no,date=no,url=no" />
23
24
  <!--[if gte mso 9]><xml>
24
25
  <o:OfficeDocumentSettings>
25
26
  <o:AllowPNG/>
@@ -27,83 +28,143 @@ const convertJsonToHtml = async (jsonData) => {
27
28
  </o:OfficeDocumentSettings>
28
29
  </xml><![endif]-->
29
30
  <style>
30
- .responsive-table {
31
- width: 100%;
32
- max-width: 600px;
31
+ html, body {
32
+ margin: 0 !important;
33
+ padding: 0 !important;
34
+ width: 100% !important;
35
+ -ms-text-size-adjust: 100%;
36
+ -webkit-text-size-adjust: 100%;
37
+ }
38
+
39
+ body, table, td, p, a {
40
+ font-family: ${(0, fontFallback_1.withFontFallback)(fontFamily)};
41
+ }
42
+
43
+ table, td {
44
+ mso-table-lspace: 0pt;
45
+ mso-table-rspace: 0pt;
46
+ border-collapse: collapse !important;
47
+ }
48
+
49
+ img {
50
+ -ms-interpolation-mode: bicubic;
51
+ border: 0;
52
+ outline: none;
53
+ text-decoration: none;
54
+ display: block;
55
+ height: auto;
56
+ line-height: 100%;
57
+ }
58
+
59
+ a {
60
+ text-decoration: none;
61
+ color: inherit;
62
+ }
63
+
64
+ .email-container {
65
+ width: 100%;
66
+ max-width: 600px;
67
+ margin: 0 auto;
68
+ }
69
+
70
+ .stack-column,
71
+ .stack-column-cell {
72
+ vertical-align: top;
73
+ }
74
+
75
+ .hide-mobile {
76
+ display: block !important;
77
+ max-height: none !important;
78
+ overflow: visible !important;
79
+ }
80
+
81
+ .hide-desktop {
82
+ display: none !important;
83
+ max-height: 0 !important;
84
+ overflow: hidden !important;
85
+ mso-hide: all !important;
86
+ }
87
+
88
+ @media only screen and (max-width: 600px) {
89
+ .email-container {
90
+ width: 100% !important;
33
91
  }
34
- @media only screen and (max-width: 600px) {
35
- .responsive-table {
36
- width: 100% !important;
37
- }
38
- .stack-column,
39
- .stack-column td {
40
- display: block !important;
41
- width: 100% !important;
42
- max-width: 100% !important;
43
- }
92
+
93
+ .stack-column,
94
+ .stack-column-cell {
95
+ display: block !important;
96
+ width: 100% !important;
97
+ max-width: 100% !important;
44
98
  }
99
+
45
100
  .hide-mobile {
46
- display: block !important;
47
- }
48
-
49
- .hide-desktop {
50
- display: block !important;
51
- mso-hide: all !important; /* Hide in Outlook (treated as desktop) */
52
- }
53
-
54
- @media only screen and (max-width: 600px) {
55
- .hide-mobile {
56
- display: none !important;
57
- max-height: 0 !important;
58
- overflow: hidden !important;
59
- mso-hide: all !important;
60
- }
61
- }
62
-
63
- @media only screen and (min-width: 601px) {
64
- .hide-desktop {
65
- display: none !important;
66
- max-height: 0 !important;
67
- overflow: hidden !important;
68
- mso-hide: all !important;
69
- }
70
- }
71
-
72
- </style>
73
- </head>
74
- <body style="margin:0; padding:0; background-color:${canvasColor};">
75
- <center style="width:100%; background-color:${canvasColor};">
76
- <table
77
- class="responsive-table"
78
- role="presentation"
79
- bgcolor="${canvasColor}"
80
- cellpadding="0"
81
- cellspacing="0"
82
- border="0"
83
- width="600"
84
- align="center"
85
- style="
86
- font-family: ${(0, fontFallback_1.withFontFallback)(fontFamily)};
87
- margin: 0 auto;
88
- table-layout:fixed;
89
- width:600px;
90
- max-width:600px;
91
- background-color: ${canvasColor};
92
- ${textColor ? `color: ${textColor};` : ''}
93
- ${borderWidth ? `border: ${borderWidth}px ${borderStyle || 'solid'} ${borderColor || 'transparent'};` : ''}
94
- ${borderRadius ? `border-radius: ${borderRadius}px;` : ''}"
95
- >
96
- <tbody>
97
- <tr>
98
- <td style="padding: ${top}px ${right}px ${bottom}px ${left}px;">
99
- ${blocksHtml.join("")}
100
- </td>
101
- </tr>
102
- </tbody>
103
- </table>
104
- </center>
105
- </body>
106
- </html>`;
101
+ display: none !important;
102
+ max-height: 0 !important;
103
+ overflow: hidden !important;
104
+ mso-hide: all !important;
105
+ }
106
+
107
+ .hide-desktop {
108
+ display: block !important;
109
+ max-height: none !important;
110
+ overflow: visible !important;
111
+ }
112
+ }
113
+ </style>
114
+ </head>
115
+ <body style="margin:0; padding:0; background-color:${canvasColor || '#ffffff'};">
116
+ <center style="width:100%; background-color:${canvasColor || '#ffffff'};">
117
+
118
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="${canvasColor || '#ffffff'}">
119
+ <tr>
120
+ <td align="center">
121
+
122
+ <!--[if mso]>
123
+ <table role="presentation" border="0" cellspacing="0" cellpadding="0" width="600">
124
+ <tr>
125
+ <td>
126
+ <![endif]-->
127
+
128
+ <table
129
+ role="presentation"
130
+ class="email-container"
131
+ bgcolor="${canvasColor || '#ffffff'}"
132
+ cellpadding="0"
133
+ cellspacing="0"
134
+ border="0"
135
+ width="100%"
136
+ style="
137
+ font-family: ${(0, fontFallback_1.withFontFallback)(fontFamily)};
138
+ table-layout: fixed;
139
+ width: 100%;
140
+ max-width: 600px;
141
+ background-color: ${canvasColor || '#ffffff'};
142
+ ${textColor ? `color: ${textColor};` : ''}
143
+ ${borderWidth ? `border: ${borderWidth}px ${borderStyle || 'solid'} ${borderColor || 'transparent'};` : ''}
144
+ ${borderRadius ? `border-radius: ${borderRadius}px;` : ''}"
145
+ >
146
+ <tbody>
147
+ <tr>
148
+ <td style="padding: ${top}px ${right}px ${bottom}px ${left}px;">
149
+ ${blocksHtml.join("")}
150
+ </td>
151
+ </tr>
152
+ </tbody>
153
+ </table>
154
+
155
+ <!--[if mso]>
156
+ </td>
157
+ </tr>
158
+ </table>
159
+ <![endif]-->
160
+
161
+ </td>
162
+ </tr>
163
+ </table>
164
+
165
+ </center>
166
+ </body>
167
+ </html>`;
107
168
  return rawHtml;
108
169
  };
109
170
  exports.convertJsonToHtml = convertJsonToHtml;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "email-builder-utils",
3
- "version": "1.1.47",
3
+ "version": "1.1.48",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [