@websolutespa/bom-mixer-emails 3.1.0 → 3.1.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @websolutespa/bom-mixer-emails
2
2
 
3
+ ## 3.1.2
4
+
5
+ ## 3.1.1
6
+
3
7
  ## 3.1.0
4
8
 
5
9
  ### Minor Changes
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/app.tsx","../src/render.tsx"],"sourcesContent":["import { LabelProvider, LayoutProvider } from '@websolutespa/bom-mixer-hooks';\r\nimport { IEmailAppComponent } from './types';\r\n\r\nexport const App: IEmailAppComponent = ({ Component, Layout, ...props }) => {\r\n const LayoutComponent = Component.Layout || Layout;\r\n return (\r\n <LayoutProvider layout={props.layout}>\r\n <LabelProvider>\r\n <LayoutComponent {...props}>\r\n <Component {...props}></Component>\r\n </LayoutComponent>\r\n </LabelProvider>\r\n </LayoutProvider>\r\n );\r\n};\r\n","import { render } from '@react-email/render';\nimport { isDevelopment } from '@websolutespa/bom-core';\nimport { App } from './app';\nimport { IEmailAppProps } from './types';\n\nexport async function renderEmail<T>(props: IEmailAppProps<T>): Promise<string> {\n // console.log('renderEmail.props', props);\n const renderOptions = { pretty: isDevelopment };\n // console.log('renderEmail.renderOptions', renderOptions);\n try {\n const html = await render((<App {...props} />), renderOptions);\n // console.log('renderEmail', 'html', html);\n return html;\n } catch (error) {\n console.log(error);\n return 'An error occurred';\n }\n}\n"],"mappings":";;;;AAGA,MAAa,OAA2B,EAAE,WAAW,QAAQ,GAAG,YAAY;CAC1E,MAAM,kBAAkB,UAAU,UAAU;AAC5C,QACE,CAAC,eAAe,QAAQ,MAAM,QAAQ;MACpC,CAAC,cAAc;QACb,CAAC,oBAAoB,OAAO;UAC1B,CAAC,cAAc,OAAO,EAAE,UAAU;QACpC,EAAE,gBAAgB;MACpB,EAAE,cAAc;IAClB,EAAE;;;;ACPN,eAAsB,YAAe,OAA2C;CAE9E,MAAM,gBAAgB,EAAE,QAAQ,eAAe;AAE/C,KAAI;AAGF,SAFa,MAAM,OAAQ,CAAC,QAAQ,WAAY,cAAc;UAGvD,OAAO;AACd,UAAQ,IAAI,MAAM;AAClB,SAAO"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/app.tsx","../src/render.tsx"],"sourcesContent":["import { LabelProvider, LayoutProvider } from '@websolutespa/bom-mixer-hooks';\r\nimport { IEmailAppComponent } from './types';\r\n\r\nexport const App: IEmailAppComponent = ({ Component, Layout, ...props }) => {\r\n const LayoutComponent = Component.Layout || Layout;\r\n return (\r\n <LayoutProvider layout={props.layout}>\r\n <LabelProvider>\r\n <LayoutComponent {...props}>\r\n <Component {...props}></Component>\r\n </LayoutComponent>\r\n </LabelProvider>\r\n </LayoutProvider>\r\n );\r\n};\r\n","import { render } from '@react-email/render';\r\nimport { isDevelopment } from '@websolutespa/bom-core';\r\nimport { App } from './app';\r\nimport { IEmailAppProps } from './types';\r\n\r\nexport async function renderEmail<T>(props: IEmailAppProps<T>): Promise<string> {\r\n // console.log('renderEmail.props', props);\r\n const renderOptions = { pretty: isDevelopment };\r\n // console.log('renderEmail.renderOptions', renderOptions);\r\n try {\r\n const html = await render((<App {...props} />), renderOptions);\r\n // console.log('renderEmail', 'html', html);\r\n return html;\r\n } catch (error) {\r\n console.log(error);\r\n return 'An error occurred';\r\n }\r\n}\r\n"],"mappings":";;;;AAGA,MAAa,OAA2B,EAAE,WAAW,QAAQ,GAAG,YAAY;CAC1E,MAAM,kBAAkB,UAAU,UAAU;AAC5C,QACE,CAAC,eAAe,QAAQ,MAAM,QAAQ;MACpC,CAAC,cAAc;QACb,CAAC,oBAAoB,OAAO;UAC1B,CAAC,cAAc,OAAO,EAAE,UAAU;QACpC,EAAE,gBAAgB;MACpB,EAAE,cAAc;IAClB,EAAE;;;;ACPN,eAAsB,YAAe,OAA2C;CAE9E,MAAM,gBAAgB,EAAE,QAAQ,eAAe;AAE/C,KAAI;AAGF,SAFa,MAAM,OAAQ,CAAC,QAAQ,WAAY,cAAc;UAGvD,OAAO;AACd,UAAQ,IAAI,MAAM;AAClB,SAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-emails",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Mixer Emails module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -38,10 +38,10 @@
38
38
  "@types/react": "19.2.18",
39
39
  "@types/react-dom": "19.2.7",
40
40
  "@vitest/coverage-istanbul": "5.0.5",
41
- "@websolutespa/bom-cli": "^3.1.0",
42
- "@websolutespa/eslint-config": "^3.1.0",
43
- "@websolutespa/test": "^3.1.0",
44
- "@websolutespa/tsconfig": "^3.1.0",
41
+ "@websolutespa/bom-cli": "^3.1.2",
42
+ "@websolutespa/eslint-config": "^3.1.2",
43
+ "@websolutespa/test": "^3.1.2",
44
+ "@websolutespa/tsconfig": "^3.1.2",
45
45
  "eslint": "10.13.0",
46
46
  "npm-run-all": "4.1.5",
47
47
  "react": "19.2.9",
@@ -81,12 +81,12 @@
81
81
  },
82
82
  "types": "./dist/index.d.ts",
83
83
  "main": "./dist/index.js",
84
- "source": "./src/index.ts",
85
84
  "exports": {
86
85
  ".": {
87
86
  "import": "./dist/index.js",
88
87
  "types": "./dist/index.d.ts",
89
88
  "default": "./dist/index.js"
90
89
  }
91
- }
90
+ },
91
+ "source": "./src/index.ts"
92
92
  }
@@ -1,31 +1,31 @@
1
- import { Body, Html, Text } from '@react-email/components';
2
- import type { ILayout } from '@websolutespa/bom-core';
3
- import { describe, expect, it } from 'vitest';
4
- import { renderEmail } from '../render';
5
- import type { IEmailComponent, IEmailLayoutComponent } from '../types';
6
-
7
- const Layout: IEmailLayoutComponent = ({ children }) => (
8
- <Html lang="en">
9
- <Body>{children}</Body>
10
- </Html>
11
- );
12
-
13
- const Component: IEmailComponent<{ name: string }> = ({ props }) => (
14
- <Text>Hello {props.name}</Text>
15
- );
16
-
17
- describe('renderEmail', () => {
18
- it('renders the component inside the layout as an html document', async () => {
19
- const html = await renderEmail({
20
- Component,
21
- Layout,
22
- layout: { labels: [] } as unknown as ILayout,
23
- origin: 'https://example.com',
24
- props: { name: 'Ada' },
25
- });
26
-
27
- expect(html.startsWith('<!DOCTYPE html')).toBe(true);
28
- expect(html).toMatch(/<html[^>]* lang="en"/);
29
- expect(html).toMatch(/Hello (<!-- -->)?Ada/);
30
- });
31
- });
1
+ import { Body, Html, Text } from '@react-email/components';
2
+ import type { ILayout } from '@websolutespa/bom-core';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { renderEmail } from '../render';
5
+ import type { IEmailComponent, IEmailLayoutComponent } from '../types';
6
+
7
+ const Layout: IEmailLayoutComponent = ({ children }) => (
8
+ <Html lang="en">
9
+ <Body>{children}</Body>
10
+ </Html>
11
+ );
12
+
13
+ const Component: IEmailComponent<{ name: string }> = ({ props }) => (
14
+ <Text>Hello {props.name}</Text>
15
+ );
16
+
17
+ describe('renderEmail', () => {
18
+ it('renders the component inside the layout as an html document', async () => {
19
+ const html = await renderEmail({
20
+ Component,
21
+ Layout,
22
+ layout: { labels: [] } as unknown as ILayout,
23
+ origin: 'https://example.com',
24
+ props: { name: 'Ada' },
25
+ });
26
+
27
+ expect(html.startsWith('<!DOCTYPE html')).toBe(true);
28
+ expect(html).toMatch(/<html[^>]* lang="en"/);
29
+ expect(html).toMatch(/Hello (<!-- -->)?Ada/);
30
+ });
31
+ });
package/src/render.tsx CHANGED
@@ -1,18 +1,18 @@
1
- import { render } from '@react-email/render';
2
- import { isDevelopment } from '@websolutespa/bom-core';
3
- import { App } from './app';
4
- import { IEmailAppProps } from './types';
5
-
6
- export async function renderEmail<T>(props: IEmailAppProps<T>): Promise<string> {
7
- // console.log('renderEmail.props', props);
8
- const renderOptions = { pretty: isDevelopment };
9
- // console.log('renderEmail.renderOptions', renderOptions);
10
- try {
11
- const html = await render((<App {...props} />), renderOptions);
12
- // console.log('renderEmail', 'html', html);
13
- return html;
14
- } catch (error) {
15
- console.log(error);
16
- return 'An error occurred';
17
- }
18
- }
1
+ import { render } from '@react-email/render';
2
+ import { isDevelopment } from '@websolutespa/bom-core';
3
+ import { App } from './app';
4
+ import { IEmailAppProps } from './types';
5
+
6
+ export async function renderEmail<T>(props: IEmailAppProps<T>): Promise<string> {
7
+ // console.log('renderEmail.props', props);
8
+ const renderOptions = { pretty: isDevelopment };
9
+ // console.log('renderEmail.renderOptions', renderOptions);
10
+ try {
11
+ const html = await render((<App {...props} />), renderOptions);
12
+ // console.log('renderEmail', 'html', html);
13
+ return html;
14
+ } catch (error) {
15
+ console.log(error);
16
+ return 'An error occurred';
17
+ }
18
+ }