@websolutespa/bom-mixer-emails 3.0.1 → 3.1.0
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 +20 -0
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -15
- package/dist/index.js.map +1 -1
- package/package.json +22 -19
- package/src/__tests/render.test.tsx +31 -0
- package/src/render.tsx +18 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @websolutespa/bom-mixer-emails
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3f7c21b: - Payload 3.91.0 and Next.js 16.4.2 (React 19.2.9): peer dependencies are now ranges, `payload` / `@payloadcms/*` `^3.91.0`, `next` `^16.3.3`, `react` / `react-dom` `^19.2.1`
|
|
8
|
+
- payload-plugin-bowl: the mixer context is built only for reads by an authenticated user (payload 3.90+ resolves the jwt user with the request query, populating tenants before `req.user` is set); email options typed with payload `SendEmailOptions`, no direct nodemailer dependency
|
|
9
|
+
- payload-plugin-storage: `AZURE_STORAGE_CONTAINER_ACCESS` (`private` default since payload 3.90, `blob`, `container`) for containers created by the plugin
|
|
10
|
+
- mixer web: `images.qualities` includes `IMAGE_QUALITY` (next 16 defaults to `[75]`)
|
|
11
|
+
- cef3bd8: - bom-mixer-emails: @react-email/components 1.0.12 and @react-email/render 2.1.1 (react 19); `renderEmail` is now async and returns `Promise<string>`
|
|
12
|
+
- payload-plugin-bowl-llm: openai 7.42.0 (zod 4), @modelcontextprotocol/sdk 1.32.1
|
|
13
|
+
- bom-cli: openai 7.42.0 client (`chat.completions`, `completions`)
|
|
14
|
+
- sonner 2.0.8
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- d88019f: - library majors: uuid 14, marked 18 (llm text renderer ported to token renderers), mime 4, mime-types 3, iron-session 9, node-cron 4, html-to-text 10, react-error-boundary 6, react-dropzone 20 (import modal accepts `text/csv` `.csv`), fast-equals 6, schema-dts 2, json-schema-typed 9, dotenv 18 (quiet), chalk 6, giget 3, @clack/prompts 1, keeper secrets manager 17
|
|
19
|
+
- 12b6e2f: - test: replace the jest presets with shared vitest configurations, `@websolutespa/test/vitest` (`defineNodeConfig`, `defineDomConfig`, `definePayloadConfig`); drop jest dependencies
|
|
20
|
+
- declare every imported package and script binary in the package that uses it (no more reliance on hoisting), drop unused dependencies
|
|
21
|
+
- bom-mixer-checkout: `useCart.add` no longer mutates the previous cart state
|
|
22
|
+
|
|
3
23
|
## 3.0.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -28,16 +28,12 @@ type IEmailComponent<T> = FC<Readonly<IEmailSharedProps & {
|
|
|
28
28
|
}>> & {
|
|
29
29
|
Layout?: IEmailLayoutComponent;
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=types.d.ts.map
|
|
32
31
|
//#endregion
|
|
33
32
|
//#region src/app.d.ts
|
|
34
33
|
declare const App: IEmailAppComponent;
|
|
35
|
-
//# sourceMappingURL=app.d.ts.map
|
|
36
34
|
//#endregion
|
|
37
35
|
//#region src/render.d.ts
|
|
38
|
-
declare function renderEmail<T>(props: IEmailAppProps<T>): string
|
|
39
|
-
//# sourceMappingURL=render.d.ts.map
|
|
40
|
-
|
|
36
|
+
declare function renderEmail<T>(props: IEmailAppProps<T>): Promise<string>;
|
|
41
37
|
//#endregion
|
|
42
38
|
export { App, IEmailAppComponent, IEmailAppProps, IEmailComponent, IEmailLayoutComponent, IEmailLayoutProps, IEmailSharedProps, renderEmail };
|
|
43
39
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/app.tsx","../src/render.tsx"],"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/app.tsx","../src/render.tsx"],"mappings":";;;;KAGY,iBAAA;EACV,MAAA;EACA,MAAA,EAAQ,OAAA;EACR,QAAA;EACA,SAAA;EACA,YAAA;EACA,OAAA;AAAA;AAAA,KAGU,cAAA,MAAoB,iBAAA;EAC9B,SAAA,EAAW,eAAA,CAAgB,CAAA;EAC3B,MAAA,EAAQ,qBAAA;EACR,KAAA,EAAO,CAAA;AAAA;AAAA,KAGG,kBAAA,YAA8B,EAAA,CAAG,QAAA,CAAS,cAAA,CAAe,CAAA;AAAA,KAEzD,iBAAA,MAAuB,iBAAA;EACjC,SAAA,EAAW,eAAA,CAAgB,CAAA;EAC3B,KAAA,EAAO,CAAA;AAAA;AAAA,KAGG,qBAAA,GAAwB,EAAA,CAAG,QAAA,CAAS,iBAAA;EAAsB,QAAA,EAAU,SAAA;AAAA;AAAA,KAEpE,eAAA,MAAqB,EAAA,CAAG,QAAA,CAAS,iBAAA;EAAsB,KAAA,EAAO,CAAA;AAAA;EACxE,MAAA,GAAS,qBAAA;AAAA;;;cCzBE,GAAA,EAAK,kBAAA;;;iBCEI,WAAA,GAAA,CAAe,KAAA,EAAO,cAAA,CAAe,CAAA,IAAK,OAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
import { LabelProvider, LayoutProvider } from "@websolutespa/bom-mixer-hooks";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { render } from "@react-email/render";
|
|
4
3
|
import { isDevelopment } from "@websolutespa/bom-core";
|
|
5
|
-
|
|
6
4
|
//#region src/app.tsx
|
|
7
|
-
const App = ({ Component, Layout
|
|
5
|
+
const App = ({ Component, Layout, ...props }) => {
|
|
8
6
|
const LayoutComponent = Component.Layout || Layout;
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
return <LayoutProvider layout={props.layout}>
|
|
8
|
+
<LabelProvider>
|
|
9
|
+
<LayoutComponent {...props}>
|
|
10
|
+
<Component {...props}></Component>
|
|
11
|
+
</LayoutComponent>
|
|
12
|
+
</LabelProvider>
|
|
13
|
+
</LayoutProvider>;
|
|
16
14
|
};
|
|
17
|
-
|
|
18
15
|
//#endregion
|
|
19
16
|
//#region src/render.tsx
|
|
20
|
-
function renderEmail(props) {
|
|
17
|
+
async function renderEmail(props) {
|
|
21
18
|
const renderOptions = { pretty: isDevelopment };
|
|
22
19
|
try {
|
|
23
|
-
|
|
24
|
-
return html;
|
|
20
|
+
return await render(<App {...props} />, renderOptions);
|
|
25
21
|
} catch (error) {
|
|
26
22
|
console.log(error);
|
|
27
23
|
return "An error occurred";
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
//#endregion
|
|
32
27
|
export { App, renderEmail };
|
|
28
|
+
|
|
33
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/bom-mixer-emails",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Mixer Emails module of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bom",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "git://github.com/websolutespa/bom.git"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"lint": "eslint
|
|
16
|
+
"lint": "eslint .",
|
|
17
17
|
"test": "vitest run",
|
|
18
18
|
"test-watch": "vitest",
|
|
19
19
|
"coverage:integration": "npm run test -- --coverage.enabled --coverage.provider=istanbul --coverage.all",
|
|
@@ -25,28 +25,31 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@react-email/components": "
|
|
29
|
-
"@react-email/render": "
|
|
28
|
+
"@react-email/components": "^1.0.12",
|
|
29
|
+
"@react-email/render": "^2.1.1",
|
|
30
30
|
"@websolutespa/bom-core": "^3.0.1",
|
|
31
31
|
"@websolutespa/bom-mixer-hooks": "^3.0.1",
|
|
32
|
-
"react
|
|
33
|
-
"react": "19.2.
|
|
32
|
+
"react": "^19.2.1",
|
|
33
|
+
"react-dom": "^19.2.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@react-email/components": "
|
|
37
|
-
"@react-email/render": "
|
|
38
|
-
"@types/react
|
|
39
|
-
"@types/react": "19.2.
|
|
40
|
-
"@
|
|
41
|
-
"@websolutespa/
|
|
42
|
-
"@websolutespa/
|
|
43
|
-
"@websolutespa/
|
|
44
|
-
"
|
|
36
|
+
"@react-email/components": "1.0.12",
|
|
37
|
+
"@react-email/render": "2.1.1",
|
|
38
|
+
"@types/react": "19.2.18",
|
|
39
|
+
"@types/react-dom": "19.2.7",
|
|
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",
|
|
45
|
+
"eslint": "10.13.0",
|
|
45
46
|
"npm-run-all": "4.1.5",
|
|
46
|
-
"react
|
|
47
|
-
"react-
|
|
48
|
-
"react": "
|
|
49
|
-
"
|
|
47
|
+
"react": "19.2.9",
|
|
48
|
+
"react-dom": "19.2.9",
|
|
49
|
+
"react-error-boundary": "6.1.6",
|
|
50
|
+
"tsdown": "0.21.0",
|
|
51
|
+
"typescript": "6.0.3",
|
|
52
|
+
"vitest": "5.0.5"
|
|
50
53
|
},
|
|
51
54
|
"publishConfig": {
|
|
52
55
|
"access": "public"
|
|
@@ -0,0 +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
|
+
});
|
package/src/render.tsx
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
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
|
+
}
|