email-builder-utils 1.0.8 → 1.0.9

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,2 +1,2 @@
1
- export declare const convertJsonToHtml: (jsonData: any) => string;
1
+ export declare const convertJsonToHtml: (jsonData: any) => Promise<string>;
2
2
  //# sourceMappingURL=convertJsonToHtml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,GAAI,UAAU,GAAG,WA6B9C,CAAA"}
1
+ {"version":3,"file":"convertJsonToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/convertJsonToHtml.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,GAAU,UAAU,GAAG,oBAgCpD,CAAA"}
@@ -2,9 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertJsonToHtml = void 0;
4
4
  const jsonToHTML_1 = require("./jsonToHTML");
5
- const convertJsonToHtml = (jsonData) => {
5
+ const convertJsonToHtml = async (jsonData) => {
6
6
  const rootData = jsonData?.root?.data;
7
- const blocksHtml = rootData?.childrenIds.map((childId) => (0, jsonToHTML_1.convertToHtml)(jsonData[childId], jsonData, 600)).join("");
7
+ const blocksHtml = [];
8
+ for (const childId of rootData?.childrenIds) {
9
+ blocksHtml.push(await (0, jsonToHTML_1.convertToHtml)(jsonData[childId], jsonData, 600));
10
+ }
8
11
  const rawHtml = `
9
12
  <!DOCTYPE html>
10
13
  <html lang="en">
@@ -23,7 +26,7 @@ const convertJsonToHtml = (jsonData) => {
23
26
  <table class="responsive-table" style="font-family:${rootData.style?.fontFamily}; margin:0 auto; background-color:${rootData.style?.canvasColor}; color:${rootData.style?.textColor}; ${jsonToHTML_1.tableCommonStyle}">
24
27
  <tbody>
25
28
  <tr>
26
- <td style="padding:0;">${blocksHtml}</td>
29
+ <td style="padding:0;">${blocksHtml.join("")}</td>
27
30
  </tr>
28
31
  </tbody>
29
32
  </table>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "email-builder-utils",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [