@metorial-services/relay-client 1.0.4 → 1.0.5

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,141 +1,126 @@
1
1
  import { createClient } from '@lowerdeck/rpc-client';
2
2
  import type { RelayClient } from '../../../service/src/controllers';
3
- import { ITemplate } from './templates';
4
3
  export * from './templates';
5
4
  type ClientOpts = Parameters<typeof createClient>[0];
6
- type EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;
7
- export declare let createRelayClient: (o: ClientOpts) => {
8
- client: import("@lowerdeck/rpc-server").InferClient<{
9
- emailIdentity: {
10
- upsert: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
11
- senderId: string;
5
+ export type EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;
6
+ export declare let createRelayClient: (o: ClientOpts) => import("@lowerdeck/rpc-server").InferClient<{
7
+ emailIdentity: {
8
+ upsert: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
9
+ senderId: string;
10
+ name: string;
11
+ email: string;
12
+ }>, {
13
+ object: string;
14
+ id: string;
15
+ type: "email";
16
+ slug: string;
17
+ fromName: string;
18
+ fromEmail: string;
19
+ senderOid: number;
20
+ createdAt: Date;
21
+ }, {
22
+ sender: {} & {
12
23
  name: string;
13
- email: string;
14
- }>, {
15
- object: string;
24
+ oid: number;
16
25
  id: string;
17
- type: "email";
18
- slug: string;
19
- fromName: string;
20
- fromEmail: string;
21
- senderOid: number;
26
+ identifier: string;
27
+ createdAt: Date;
28
+ };
29
+ }>;
30
+ get: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
31
+ senderId: string;
32
+ emailIdentityId: string;
33
+ }>, {
34
+ object: string;
35
+ id: string;
36
+ type: "email";
37
+ slug: string;
38
+ fromName: string;
39
+ fromEmail: string;
40
+ senderOid: number;
41
+ createdAt: Date;
42
+ }, {
43
+ sender: {} & {
44
+ name: string;
45
+ oid: number;
46
+ id: string;
47
+ identifier: string;
22
48
  createdAt: Date;
23
- }, {
24
- sender: {} & {
49
+ };
50
+ emailIdentity: {
51
+ sender: {
25
52
  name: string;
26
53
  oid: number;
27
54
  id: string;
28
55
  identifier: string;
29
56
  createdAt: Date;
30
57
  };
31
- }>;
32
- get: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
33
- senderId: string;
34
- emailIdentityId: string;
35
- }>, {
36
- object: string;
58
+ } & {
59
+ oid: number;
37
60
  id: string;
38
- type: "email";
61
+ createdAt: Date;
62
+ type: import("../../../service/prisma/generated/enums").EmailIdentityType;
39
63
  slug: string;
40
64
  fromName: string;
41
65
  fromEmail: string;
66
+ subjectMarker: string | null;
42
67
  senderOid: number;
43
- createdAt: Date;
44
- }, {
45
- sender: {} & {
46
- name: string;
47
- oid: number;
48
- id: string;
49
- identifier: string;
50
- createdAt: Date;
51
- };
52
- emailIdentity: {
53
- sender: {
54
- name: string;
55
- oid: number;
56
- id: string;
57
- identifier: string;
58
- createdAt: Date;
59
- };
60
- } & {
61
- oid: number;
62
- id: string;
63
- createdAt: Date;
64
- type: import("../../../service/prisma/generated/enums").EmailIdentityType;
65
- slug: string;
66
- fromName: string;
67
- fromEmail: string;
68
- subjectMarker: string | null;
69
- senderOid: number;
70
- updatedAt: Date;
71
- };
72
- }>;
73
- };
74
- sender: {
75
- upsert: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
68
+ updatedAt: Date;
69
+ };
70
+ }>;
71
+ };
72
+ sender: {
73
+ upsert: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
74
+ name: string;
75
+ identifier: string;
76
+ }>, {
77
+ object: string;
78
+ id: string;
79
+ identifier: string;
80
+ name: string;
81
+ createdAt: Date;
82
+ }, {}>;
83
+ get: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
84
+ senderId: string;
85
+ }>, {
86
+ object: string;
87
+ id: string;
88
+ identifier: string;
89
+ name: string;
90
+ createdAt: Date;
91
+ }, {
92
+ sender: {} & {
76
93
  name: string;
77
- identifier: string;
78
- }>, {
79
- object: string;
94
+ oid: number;
80
95
  id: string;
81
96
  identifier: string;
82
- name: string;
83
97
  createdAt: Date;
84
- }, {}>;
85
- get: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
86
- senderId: string;
87
- }>, {
88
- object: string;
98
+ };
99
+ }>;
100
+ };
101
+ email: {
102
+ send: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
103
+ senderId: string;
104
+ emailIdentityId: string;
105
+ type: "email" | undefined;
106
+ to: string[];
107
+ template: Record<string, any>;
108
+ content: import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
109
+ subject: string;
110
+ html: string;
111
+ text: string;
112
+ }>;
113
+ }>, {
114
+ id: string;
115
+ }, {
116
+ sender: {} & {
117
+ name: string;
118
+ oid: number;
89
119
  id: string;
90
120
  identifier: string;
91
- name: string;
92
121
  createdAt: Date;
93
- }, {
94
- sender: {} & {
95
- name: string;
96
- oid: number;
97
- id: string;
98
- identifier: string;
99
- createdAt: Date;
100
- };
101
- }>;
102
- };
103
- email: {
104
- send: import("@lowerdeck/rpc-server").Handler<import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
105
- senderId: string;
106
- emailIdentityId: string;
107
- type: "email" | undefined;
108
- to: string[];
109
- template: Record<string, any>;
110
- content: import("@lowerdeck/validation/dist/validators").UndefinedIsOptional<{
111
- subject: string;
112
- html: string;
113
- text: string;
114
- }>;
115
- }>, {
116
- id: string;
117
- }, {
118
- sender: {} & {
119
- name: string;
120
- oid: number;
121
- id: string;
122
- identifier: string;
123
- createdAt: Date;
124
- };
125
- }>;
126
- };
127
- }>;
128
- createTemplate<Data>(template: ITemplate<Data>, identity: EmailIdentity | Promise<EmailIdentity>, sender: {
129
- id: string;
130
- } | Promise<{
131
- id: string;
132
- }>): {
133
- send: (i: {
134
- data: Data;
135
- to: string[];
136
- }) => Promise<{
137
- id: string;
122
+ };
138
123
  }>;
139
124
  };
140
- };
125
+ }>;
141
126
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,cAAc,aAAa,CAAC;AAE5B,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAErD,KAAK,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE9E,eAAO,IAAI,iBAAiB,GAAI,GAAG,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAM1B,IAAI,YACP,SAAS,CAAC,IAAI,CAAC,YACf,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,UACxC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;kBAG9B;YAAE,IAAI,EAAE,IAAI,CAAC;YAAC,EAAE,EAAE,MAAM,EAAE,CAAA;SAAE;;;;CAqBnD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,cAAc,aAAa,CAAC;AAE5B,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAErD,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErF,eAAO,IAAI,iBAAiB,GAAI,GAAG,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI5C,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- var e=require("@lowerdeck/rpc-client"),t=require("react/jsx-runtime"),n=require("@react-email/components");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/r(require("react"));function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(null,arguments)}var s={padding:"27px 0 27px",textAlign:"center"},a={backgroundColor:"#000000",borderRadius:"7px",fontWeight:"600",color:"#fff",fontSize:"15px",textDecoration:"none",textAlign:"center",display:"block"},l={},c={backgroundColor:"#ffffff",margin:"0 auto",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif"},d={maxWidth:"600px",margin:"0 auto"},x={marginTop:"25px"},u={fontSize:"12px",color:"#777"},p={margin:"20px 0px",border:"none",borderBottom:"1px solid #ddd",background:"none"},f=function(e){var r=e.children,i=e.preview;return t.jsxs(n.Html,{children:[t.jsx(n.Head,{}),i&&t.jsx(n.Preview,{children:i}),t.jsx(n.Body,{style:c,children:t.jsxs(n.Container,{style:d,children:[t.jsx(n.Section,{style:x,children:t.jsx(n.Img,{src:"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png",height:"30",alt:"Metorial"})}),r,t.jsx(n.Hr,{style:p}),t.jsx(n.Section,{children:"enterprise"==process.env.METORIAL_SOURCE?t.jsx(n.Text,{style:u,children:"Sent by Metorial 💌. If you have any questions, feel free to contact us. If you need to reference this message use this ID: EMAIL_ID."}):t.jsxs(n.Text,{style:u,children:["Sent by a self hosted instance of ",t.jsx("a",{href:"https://metorial.com",children:"Metorial"}),". Contact the administrator of this instance if you have any questions."]})})]})})]})};exports.Button=function(e){var r=e.href,i=e.children;return t.jsx(n.Section,{style:s,children:t.jsx(n.Button,{style:o({},a,{padding:"12px 18px"}),href:r,children:i})})},exports.Code=function(e){var r=e.code,i=r.slice(0,3),o=r.slice(3,6);return t.jsx(n.Section,{style:{background:"#fff",border:"1px solid #ddd",borderRadius:"8px",margin:"20px 0px",padding:"6px 15px"},children:t.jsxs(n.Text,{style:{fontSize:"20px",textAlign:"center",verticalAlign:"middle"},children:[t.jsx("span",{children:i}),t.jsx("span",{style:{margin:"0 5px",color:"#aaa"},children:"-"}),t.jsx("span",{children:o})]})})},exports.DataList=function(e){return t.jsx(n.Section,{style:l,children:e.items.map(function(e,r){var i=e.value;return t.jsx(n.Row,{children:t.jsxs(n.Column,{style:{padding:"10px 0px"},children:[t.jsxs(n.Text,{style:{fontSize:14,fontWeight:"bold",padding:"3px 0px",margin:0},children:[e.label,":"," "]}),t.jsx(n.Text,{style:{fontSize:14,padding:"3px 0px",margin:0},children:i})]})},r)})})},exports.Layout=function(e){var r=e.title,s=e.description,a=e.children,l=e.style;return t.jsxs(i.default.Fragment,{children:[t.jsx(n.Text,{style:o({fontFamily:"sans-serif",fontSize:20,fontWeight:"bold",marginBottom:10},l),children:r}),s&&t.jsx(n.Text,{style:o({fontFamily:"sans-serif",fontSize:16,marginBottom:20},l),children:s}),a]})},exports.Text=function(e){var r=e.children;return t.jsx(n.Text,{style:o({fontFamily:"sans-serif",fontSize:14},e.style),children:r})},exports.Wrapper=f,exports.createEmail=function(e){var r=e.subject,i=t.jsx(f,{preview:e.preview,children:e.content});return{subject:r,html:n.render(i,{plainText:!1}),text:n.render(i,{plainText:!0})}},exports.createRelayClient=function(t){var n=e.createClient(t);return{client:n,createTemplate:function(e,t,r){return{send:function(i){try{return Promise.resolve(e.render(i.data)).then(function(e){var o=n.email,s=o.send,a=i.data,l=i.to;return Promise.resolve(t).then(function(t){var n=t.id;return Promise.resolve(r).then(function(t){var r=t.id,i=e.subject;return Promise.resolve(e.html).then(function(t){return Promise.resolve(e.text).then(function(e){return Promise.resolve(s.call(o,{type:"email",to:l,template:a,emailIdentityId:n,senderId:r,content:{subject:i,html:t,text:e}}))})})})})})}catch(e){return Promise.reject(e)}}}}}},exports.createTemplate=function(e){return e};
1
+ var e=require("@lowerdeck/rpc-client"),t=require("react/jsx-runtime"),n=require("@react-email/components");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/r(require("react"));function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(null,arguments)}var s={padding:"27px 0 27px",textAlign:"center"},a={backgroundColor:"#000000",borderRadius:"7px",fontWeight:"600",color:"#fff",fontSize:"15px",textDecoration:"none",textAlign:"center",display:"block"},l={},c={backgroundColor:"#ffffff",margin:"0 auto",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif"},d={maxWidth:"600px",margin:"0 auto"},x={marginTop:"25px"},p={fontSize:"12px",color:"#777"},f={margin:"20px 0px",border:"none",borderBottom:"1px solid #ddd",background:"none"},u=function(e){var r=e.children,i=e.preview;return t.jsxs(n.Html,{children:[t.jsx(n.Head,{}),i&&t.jsx(n.Preview,{children:i}),t.jsx(n.Body,{style:c,children:t.jsxs(n.Container,{style:d,children:[t.jsx(n.Section,{style:x,children:t.jsx(n.Img,{src:"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png",height:"30",alt:"Metorial"})}),r,t.jsx(n.Hr,{style:f}),t.jsx(n.Section,{children:"enterprise"==process.env.METORIAL_SOURCE?t.jsx(n.Text,{style:p,children:"Sent by Metorial 💌. If you have any questions, feel free to contact us. If you need to reference this message use this ID: EMAIL_ID."}):t.jsxs(n.Text,{style:p,children:["Sent by a self hosted instance of ",t.jsx("a",{href:"https://metorial.com",children:"Metorial"}),". Contact the administrator of this instance if you have any questions."]})})]})})]})};exports.Button=function(e){var r=e.href,i=e.children;return t.jsx(n.Section,{style:s,children:t.jsx(n.Button,{style:o({},a,{padding:"12px 18px"}),href:r,children:i})})},exports.Code=function(e){var r=e.code,i=r.slice(0,3),o=r.slice(3,6);return t.jsx(n.Section,{style:{background:"#fff",border:"1px solid #ddd",borderRadius:"8px",margin:"20px 0px",padding:"6px 15px"},children:t.jsxs(n.Text,{style:{fontSize:"20px",textAlign:"center",verticalAlign:"middle"},children:[t.jsx("span",{children:i}),t.jsx("span",{style:{margin:"0 5px",color:"#aaa"},children:"-"}),t.jsx("span",{children:o})]})})},exports.DataList=function(e){return t.jsx(n.Section,{style:l,children:e.items.map(function(e,r){var i=e.value;return t.jsx(n.Row,{children:t.jsxs(n.Column,{style:{padding:"10px 0px"},children:[t.jsxs(n.Text,{style:{fontSize:14,fontWeight:"bold",padding:"3px 0px",margin:0},children:[e.label,":"," "]}),t.jsx(n.Text,{style:{fontSize:14,padding:"3px 0px",margin:0},children:i})]})},r)})})},exports.Layout=function(e){var r=e.title,s=e.description,a=e.children,l=e.style;return t.jsxs(i.default.Fragment,{children:[t.jsx(n.Text,{style:o({fontFamily:"sans-serif",fontSize:20,fontWeight:"bold",marginBottom:10},l),children:r}),s&&t.jsx(n.Text,{style:o({fontFamily:"sans-serif",fontSize:16,marginBottom:20},l),children:s}),a]})},exports.Text=function(e){var r=e.children;return t.jsx(n.Text,{style:o({fontFamily:"sans-serif",fontSize:14},e.style),children:r})},exports.Wrapper=u,exports.createEmail=function(e){var r=e.subject,i=t.jsx(u,{preview:e.preview,children:e.content});return{subject:r,html:n.render(i,{plainText:!1}),text:n.render(i,{plainText:!0})}},exports.createRelayClient=function(t){return e.createClient(t)},exports.createTemplate=function(e){return e};
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/templates/components/button.tsx","../src/templates/components/dataList.tsx","../src/templates/components/wrapper.tsx","../src/templates/components/code.tsx","../src/templates/components/layout.tsx","../src/templates/components/text.tsx","../src/templates/lib/email.tsx","../src/index.ts","../src/templates/template.ts"],"sourcesContent":["import { Button as EmailButton, Section } from '@react-email/components';\nimport React from 'react';\n\nlet buttonContainer = {\n padding: '27px 0 27px',\n textAlign: 'center' as const\n};\n\nlet button = {\n backgroundColor: '#000000',\n borderRadius: '7px',\n fontWeight: '600',\n color: '#fff',\n fontSize: '15px',\n textDecoration: 'none',\n textAlign: 'center' as const,\n display: 'block'\n};\n\nexport let Button = ({ href, children }: { href: string; children: React.ReactNode }) => {\n return (\n <Section style={buttonContainer}>\n <EmailButton style={{ ...button, padding: '12px 18px' }} href={href}>\n {children as any}\n </EmailButton>\n </Section>\n );\n};\n","import { Column, Row, Section, Text } from '@react-email/components';\n\nlet container = {\n // background: '#efefef',\n // border: '1px solid #ccc'\n};\n\nexport let DataList = ({ items }: { items: { label: string; value: string }[] }) => {\n return (\n <Section style={container}>\n {items.map(({ label, value }, i) => (\n <Row key={i}>\n <Column style={{ padding: '10px 0px' }}>\n <Text style={{ fontSize: 14, fontWeight: 'bold', padding: '3px 0px', margin: 0 }}>\n {label}:{' '}\n </Text>\n <Text style={{ fontSize: 14, padding: '3px 0px', margin: 0 }}>{value}</Text>\n </Column>\n </Row>\n ))}\n </Section>\n );\n};\n","import {\n Body,\n Container,\n Head,\n Hr,\n Html,\n Img,\n Preview,\n Section,\n Text\n} from '@react-email/components';\nimport React from 'react';\n\nlet main = {\n backgroundColor: '#ffffff',\n margin: '0 auto',\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif\"\n};\n\nlet container = {\n maxWidth: '600px',\n margin: '0 auto'\n};\n\nlet logoContainer = {\n marginTop: '25px'\n};\n\nlet footerText = {\n fontSize: '12px',\n color: '#777'\n};\n\nlet hr = {\n margin: '20px 0px',\n border: 'none',\n borderBottom: '1px solid #ddd',\n background: 'none'\n};\n\nexport let Wrapper = ({\n children,\n preview\n}: {\n children?: React.ReactNode;\n preview?: string;\n}) => {\n return (\n <Html>\n <Head />\n\n {preview && <Preview>{preview}</Preview>}\n\n <Body style={main}>\n <Container style={container}>\n <Section style={logoContainer}>\n <Img\n src=\"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png\"\n height=\"30\"\n alt=\"Metorial\"\n />\n </Section>\n\n {children}\n\n <Hr style={hr} />\n\n <Section>\n {process.env.METORIAL_SOURCE == 'enterprise' ? (\n <Text style={footerText}>\n Sent by Metorial 💌. If you have any questions, feel free to contact us. If you\n need to reference this message use this ID: EMAIL_ID.\n </Text>\n ) : (\n <Text style={footerText}>\n Sent by a self hosted instance of <a href=\"https://metorial.com\">Metorial</a>.\n Contact the administrator of this instance if you have any questions.\n </Text>\n )}\n </Section>\n </Container>\n </Body>\n </Html>\n );\n};\n","import { Section, Text } from '@react-email/components';\n\nexport let Code = ({ code }: { code: string }) => {\n let first3 = code.slice(0, 3);\n let last3 = code.slice(3, 6);\n\n return (\n <Section\n style={{\n background: '#fff',\n border: '1px solid #ddd',\n borderRadius: '8px',\n margin: '20px 0px',\n padding: '6px 15px'\n }}\n >\n <Text\n style={{\n fontSize: '20px',\n textAlign: 'center',\n verticalAlign: 'middle'\n }}\n >\n <span>{first3}</span>\n <span style={{ margin: '0 5px', color: '#aaa' }}>-</span>\n <span>{last3}</span>\n </Text>\n </Section>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Layout = ({\n title,\n description,\n children,\n style\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <React.Fragment>\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 20,\n fontWeight: 'bold',\n marginBottom: 10,\n ...style\n }}\n >\n {title}\n </EmailText>\n\n {description && (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 16,\n marginBottom: 20,\n ...style\n }}\n >\n {description}\n </EmailText>\n )}\n\n {children}\n </React.Fragment>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Text = ({\n children,\n style\n}: {\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 14,\n ...style\n }}\n >\n {children}\n </EmailText>\n );\n};\n","import { render } from '@react-email/components';\nimport React from 'react';\nimport { Wrapper } from '../components/wrapper';\n\nexport interface IEmail {\n subject: string;\n html: string | Promise<string>;\n text: string | Promise<string>;\n}\n\nexport let createEmail = ({\n content,\n preview,\n subject\n}: {\n content: React.ReactElement;\n preview?: string;\n subject: string;\n}) => {\n let inner = <Wrapper preview={preview}>{content}</Wrapper>;\n\n let html = render(inner, { plainText: false });\n let text = render(inner, { plainText: true });\n\n return {\n subject,\n html,\n text\n };\n};\n","import { createClient } from '@lowerdeck/rpc-client';\nimport type { RelayClient } from '../../../service/src/controllers';\nimport { ITemplate } from './templates';\n\nexport * from './templates';\n\ntype ClientOpts = Parameters<typeof createClient>[0];\n\ntype EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;\n\nexport let createRelayClient = (o: ClientOpts) => {\n let inner = createClient<RelayClient>(o);\n\n return {\n client: inner,\n\n createTemplate<Data>(\n template: ITemplate<Data>,\n identity: EmailIdentity | Promise<EmailIdentity>,\n sender: { id: string } | Promise<{ id: string }>\n ) {\n return {\n send: async (i: { data: Data; to: string[] }) => {\n let rendered = await template.render(i.data);\n\n return await inner.email.send({\n type: 'email',\n to: i.to,\n template: i.data as any,\n\n emailIdentityId: (await identity).id,\n senderId: (await sender).id,\n\n content: {\n subject: rendered.subject,\n html: await rendered.html,\n text: await rendered.text\n }\n });\n }\n };\n }\n };\n};\n","import { IEmail } from './lib/email';\n\nexport interface ITemplate<Data> {\n render: (data: Data) => IEmail | Promise<IEmail>;\n}\n\nexport let createTemplate = <Data>(template: ITemplate<Data>) => template;\n"],"names":["buttonContainer","padding","textAlign","button","backgroundColor","borderRadius","fontWeight","color","fontSize","textDecoration","display","container","main","margin","fontFamily","maxWidth","logoContainer","marginTop","footerText","hr","border","borderBottom","background","Wrapper","_ref","children","preview","_jsxs","Html","_jsx","Head","Preview","jsx","Body","style","jsxs","Container","Section","Img","src","height","alt","Hr","process","env","METORIAL_SOURCE","Text","href","EmailButton","_extends","code","first3","slice","last3","verticalAlign","items","map","_ref2","i","value","Row","Column","label","title","description","React","Fragment","EmailText","marginBottom","subject","inner","content","html","render","plainText","text","o","createClient","client","createTemplate","template","identity","sender","send","Promise","resolve","data","then","rendered","_inner$email","email","_send","_i$data","_i$to","to","_identity","_identity$id","id","_sender","_sender$id","_rendered$subject","_rendered$html","_rendered$text","call","type","emailIdentityId","senderId","e","reject"],"mappings":"kbAGA,IAAIA,EAAkB,CACpBC,QAAS,cACTC,UAAW,UAGTC,EAAS,CACXC,gBAAiB,UACjBC,aAAc,MACdC,WAAY,MACZC,MAAO,OACPC,SAAU,OACV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b,MAAIY,KAAA,SAAAe,GAAA,OAAAlB,QAAAC,QAAAM,EAAAY,KAAAd,EAXC,CAC5Be,KAAM,QACNV,GAAED,EACFb,SAAQY,EAERa,gBAAeT,EACfU,SAAQP,EAER5B,QAAS,CACPF,QAAO+B,EACP5B,KAAI6B,EACJ1B,KAAI2B,KAGV,EAAA,EAAA,EAAA,EAAA,EAAA,CAAC,MAAAK,UAAAvB,QAAAwB,OAAAD,EAAA,CAAA,EAEL,EAEJ,yBCrC4B,SAAO3B,GAA8B,OAAAA,CAAQ"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/templates/components/button.tsx","../src/templates/components/dataList.tsx","../src/templates/components/wrapper.tsx","../src/templates/components/code.tsx","../src/templates/components/layout.tsx","../src/templates/components/text.tsx","../src/templates/lib/email.tsx","../src/index.ts","../src/templates/template.ts"],"sourcesContent":["import { Button as EmailButton, Section } from '@react-email/components';\nimport React from 'react';\n\nlet buttonContainer = {\n padding: '27px 0 27px',\n textAlign: 'center' as const\n};\n\nlet button = {\n backgroundColor: '#000000',\n borderRadius: '7px',\n fontWeight: '600',\n color: '#fff',\n fontSize: '15px',\n textDecoration: 'none',\n textAlign: 'center' as const,\n display: 'block'\n};\n\nexport let Button = ({ href, children }: { href: string; children: React.ReactNode }) => {\n return (\n <Section style={buttonContainer}>\n <EmailButton style={{ ...button, padding: '12px 18px' }} href={href}>\n {children as any}\n </EmailButton>\n </Section>\n );\n};\n","import { Column, Row, Section, Text } from '@react-email/components';\n\nlet container = {\n // background: '#efefef',\n // border: '1px solid #ccc'\n};\n\nexport let DataList = ({ items }: { items: { label: string; value: string }[] }) => {\n return (\n <Section style={container}>\n {items.map(({ label, value }, i) => (\n <Row key={i}>\n <Column style={{ padding: '10px 0px' }}>\n <Text style={{ fontSize: 14, fontWeight: 'bold', padding: '3px 0px', margin: 0 }}>\n {label}:{' '}\n </Text>\n <Text style={{ fontSize: 14, padding: '3px 0px', margin: 0 }}>{value}</Text>\n </Column>\n </Row>\n ))}\n </Section>\n );\n};\n","import {\n Body,\n Container,\n Head,\n Hr,\n Html,\n Img,\n Preview,\n Section,\n Text\n} from '@react-email/components';\nimport React from 'react';\n\nlet main = {\n backgroundColor: '#ffffff',\n margin: '0 auto',\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif\"\n};\n\nlet container = {\n maxWidth: '600px',\n margin: '0 auto'\n};\n\nlet logoContainer = {\n marginTop: '25px'\n};\n\nlet footerText = {\n fontSize: '12px',\n color: '#777'\n};\n\nlet hr = {\n margin: '20px 0px',\n border: 'none',\n borderBottom: '1px solid #ddd',\n background: 'none'\n};\n\nexport let Wrapper = ({\n children,\n preview\n}: {\n children?: React.ReactNode;\n preview?: string;\n}) => {\n return (\n <Html>\n <Head />\n\n {preview && <Preview>{preview}</Preview>}\n\n <Body style={main}>\n <Container style={container}>\n <Section style={logoContainer}>\n <Img\n src=\"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png\"\n height=\"30\"\n alt=\"Metorial\"\n />\n </Section>\n\n {children}\n\n <Hr style={hr} />\n\n <Section>\n {process.env.METORIAL_SOURCE == 'enterprise' ? (\n <Text style={footerText}>\n Sent by Metorial 💌. If you have any questions, feel free to contact us. If you\n need to reference this message use this ID: EMAIL_ID.\n </Text>\n ) : (\n <Text style={footerText}>\n Sent by a self hosted instance of <a href=\"https://metorial.com\">Metorial</a>.\n Contact the administrator of this instance if you have any questions.\n </Text>\n )}\n </Section>\n </Container>\n </Body>\n </Html>\n );\n};\n","import { Section, Text } from '@react-email/components';\n\nexport let Code = ({ code }: { code: string }) => {\n let first3 = code.slice(0, 3);\n let last3 = code.slice(3, 6);\n\n return (\n <Section\n style={{\n background: '#fff',\n border: '1px solid #ddd',\n borderRadius: '8px',\n margin: '20px 0px',\n padding: '6px 15px'\n }}\n >\n <Text\n style={{\n fontSize: '20px',\n textAlign: 'center',\n verticalAlign: 'middle'\n }}\n >\n <span>{first3}</span>\n <span style={{ margin: '0 5px', color: '#aaa' }}>-</span>\n <span>{last3}</span>\n </Text>\n </Section>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Layout = ({\n title,\n description,\n children,\n style\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <React.Fragment>\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 20,\n fontWeight: 'bold',\n marginBottom: 10,\n ...style\n }}\n >\n {title}\n </EmailText>\n\n {description && (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 16,\n marginBottom: 20,\n ...style\n }}\n >\n {description}\n </EmailText>\n )}\n\n {children}\n </React.Fragment>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Text = ({\n children,\n style\n}: {\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 14,\n ...style\n }}\n >\n {children}\n </EmailText>\n );\n};\n","import { render } from '@react-email/components';\nimport React from 'react';\nimport { Wrapper } from '../components/wrapper';\n\nexport interface IEmail {\n subject: string;\n html: string | Promise<string>;\n text: string | Promise<string>;\n}\n\nexport let createEmail = ({\n content,\n preview,\n subject\n}: {\n content: React.ReactElement;\n preview?: string;\n subject: string;\n}) => {\n let inner = <Wrapper preview={preview}>{content}</Wrapper>;\n\n let html = render(inner, { plainText: false });\n let text = render(inner, { plainText: true });\n\n return {\n subject,\n html,\n text\n };\n};\n","import { createClient } from '@lowerdeck/rpc-client';\nimport type { RelayClient } from '../../../service/src/controllers';\n\nexport * from './templates';\n\ntype ClientOpts = Parameters<typeof createClient>[0];\n\nexport type EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;\n\nexport let createRelayClient = (o: ClientOpts) => {\n let inner = createClient<RelayClient>(o);\n\n return inner;\n};\n","import { IEmail } from './lib/email';\n\nexport interface ITemplate<Data> {\n render: (data: Data) => IEmail | Promise<IEmail>;\n}\n\nexport let createTemplate = <Data>(template: ITemplate<Data>) => template;\n"],"names":["buttonContainer","padding","textAlign","button","backgroundColor","borderRadius","fontWeight","color","fontSize","textDecoration","display","container","main","margin","fontFamily","maxWidth","logoContainer","marginTop","footerText","hr","border","borderBottom","background","Wrapper","_ref","children","preview","_jsxs","Html","_jsx","Head","Preview","jsx","Body","style","jsxs","Container","Section","Img","src","height","alt","Hr","process","env","METORIAL_SOURCE","Text","href","EmailButton","_extends","code","first3","slice","last3","verticalAlign","items","map","_ref2","i","value","Row","Column","label","title","description","React","Fragment","EmailText","marginBottom","subject","inner","content","html","render","plainText","text","o","createClient","template"],"mappings":"kbAGA,IAAIA,EAAkB,CACpBC,QAAS,cACTC,UAAW,UAGTC,EAAS,CACXC,gBAAiB,UACjBC,aAAc,MACdC,WAAY,MACZC,MAAO,OACPC,SAAU,OACVC,eAAgB,OAChBP,UAAW,SACXQ,QAAS,SCdPC,EAAY,CAGf,ECQGC,EAAO,CACTR,gBAAiB,UACjBS,OAAQ,SACRC,WACE,qJAGAH,EAAY,CACdI,SAAU,QACVF,OAAQ,UAGNG,EAAgB,CAClBC,UAAW,QAGTC,EAAa,CACfV,SAAU,OACVD,MAAO,QAGLY,EAAK,CACPN,OAAQ,WACRO,OAAQ,OACRC,aAAc,iBACdC,WAAY,QAGHC,EAAU,SAAHC,GAChB,IAAAC,EAAQD,EAARC,SACAC,EAAOF,EAAPE,QAKA,OACEC,OAACC,EAAAA,KACC,CAAAH,SAAA,CAAAI,EAAAA,IAACC,EAAAA,KAAO,CAAA,GAEPJ,GAAWG,MAACE,EAAAA,kBAASL,IAEtBG,EAAAG,IAACC,EAAIA,KAAA,CAACC,MAAOtB,EACXa,SAAAE,EAAAQ,KAACC,EAASA,UAAA,CAACF,MAAOvB,EAChBc,SAAA,CAAAI,EAA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AAW,IAMpCC,KALSF,EAAAA,OAAOH,EAAO,CAAEI,WAAW,IAOxC,4BCpB+B,SAACE,GAG9B,OAFYC,eAA0BD,EAGxC,yBCP4B,SAAOE,GAA8B,OAAAA,CAAQ"}
package/dist/index.d.ts CHANGED
@@ -283,140 +283,126 @@ export interface ITemplate<Data> {
283
283
  export declare let createTemplate: <Data>(template: ITemplate<Data>) => ITemplate<Data>;
284
284
  type ClientOpts$1 = Parameters<typeof createClient>[0];
285
285
  export type EmailIdentity = Awaited<ReturnType<RelayClient["emailIdentity"]["get"]>>;
286
- export declare let createRelayClient: (o: ClientOpts$1) => {
287
- client: InferClient<{
288
- emailIdentity: {
289
- upsert: Handler<UndefinedIsOptional<{
290
- senderId: string;
286
+ export declare let createRelayClient: (o: ClientOpts$1) => InferClient<{
287
+ emailIdentity: {
288
+ upsert: Handler<UndefinedIsOptional<{
289
+ senderId: string;
290
+ name: string;
291
+ email: string;
292
+ }>, {
293
+ object: string;
294
+ id: string;
295
+ type: "email";
296
+ slug: string;
297
+ fromName: string;
298
+ fromEmail: string;
299
+ senderOid: number;
300
+ createdAt: Date;
301
+ }, {
302
+ sender: {} & {
291
303
  name: string;
292
- email: string;
293
- }>, {
294
- object: string;
304
+ oid: number;
305
+ id: string;
306
+ createdAt: Date;
307
+ identifier: string;
308
+ };
309
+ }>;
310
+ get: Handler<UndefinedIsOptional<{
311
+ senderId: string;
312
+ emailIdentityId: string;
313
+ }>, {
314
+ object: string;
315
+ id: string;
316
+ type: "email";
317
+ slug: string;
318
+ fromName: string;
319
+ fromEmail: string;
320
+ senderOid: number;
321
+ createdAt: Date;
322
+ }, {
323
+ sender: {} & {
324
+ name: string;
325
+ oid: number;
295
326
  id: string;
296
- type: "email";
297
- slug: string;
298
- fromName: string;
299
- fromEmail: string;
300
- senderOid: number;
301
327
  createdAt: Date;
302
- }, {
303
- sender: {} & {
328
+ identifier: string;
329
+ };
330
+ emailIdentity: {
331
+ sender: {
304
332
  name: string;
305
333
  oid: number;
306
334
  id: string;
307
335
  createdAt: Date;
308
336
  identifier: string;
309
337
  };
310
- }>;
311
- get: Handler<UndefinedIsOptional<{
312
- senderId: string;
313
- emailIdentityId: string;
314
- }>, {
315
- object: string;
338
+ } & {
339
+ oid: number;
316
340
  id: string;
317
- type: "email";
341
+ type: EmailIdentityType;
318
342
  slug: string;
319
343
  fromName: string;
320
344
  fromEmail: string;
345
+ subjectMarker: string | null;
321
346
  senderOid: number;
322
347
  createdAt: Date;
323
- }, {
324
- sender: {} & {
325
- name: string;
326
- oid: number;
327
- id: string;
328
- createdAt: Date;
329
- identifier: string;
330
- };
331
- emailIdentity: {
332
- sender: {
333
- name: string;
334
- oid: number;
335
- id: string;
336
- createdAt: Date;
337
- identifier: string;
338
- };
339
- } & {
340
- oid: number;
341
- id: string;
342
- type: EmailIdentityType;
343
- slug: string;
344
- fromName: string;
345
- fromEmail: string;
346
- subjectMarker: string | null;
347
- senderOid: number;
348
- createdAt: Date;
349
- updatedAt: Date;
350
- };
351
- }>;
352
- };
353
- sender: {
354
- upsert: Handler<UndefinedIsOptional<{
348
+ updatedAt: Date;
349
+ };
350
+ }>;
351
+ };
352
+ sender: {
353
+ upsert: Handler<UndefinedIsOptional<{
354
+ name: string;
355
+ identifier: string;
356
+ }>, {
357
+ object: string;
358
+ id: string;
359
+ identifier: string;
360
+ name: string;
361
+ createdAt: Date;
362
+ }, {}>;
363
+ get: Handler<UndefinedIsOptional<{
364
+ senderId: string;
365
+ }>, {
366
+ object: string;
367
+ id: string;
368
+ identifier: string;
369
+ name: string;
370
+ createdAt: Date;
371
+ }, {
372
+ sender: {} & {
355
373
  name: string;
356
- identifier: string;
357
- }>, {
358
- object: string;
374
+ oid: number;
359
375
  id: string;
360
- identifier: string;
361
- name: string;
362
376
  createdAt: Date;
363
- }, {}>;
364
- get: Handler<UndefinedIsOptional<{
365
- senderId: string;
366
- }>, {
367
- object: string;
368
- id: string;
369
377
  identifier: string;
370
- name: string;
371
- createdAt: Date;
372
- }, {
373
- sender: {} & {
374
- name: string;
375
- oid: number;
376
- id: string;
377
- createdAt: Date;
378
- identifier: string;
379
- };
380
- }>;
381
- };
382
- email: {
383
- send: Handler<UndefinedIsOptional<{
384
- senderId: string;
385
- emailIdentityId: string;
386
- type: "email" | undefined;
387
- to: string[];
388
- template: Record<string, any>;
389
- content: UndefinedIsOptional<{
390
- subject: string;
391
- html: string;
392
- text: string;
393
- }>;
394
- }>, {
395
- id: string;
396
- }, {
397
- sender: {} & {
398
- name: string;
399
- oid: number;
400
- id: string;
401
- createdAt: Date;
402
- identifier: string;
403
- };
404
- }>;
405
- };
406
- }>;
407
- createTemplate<Data>(template: ITemplate<Data>, identity: EmailIdentity | Promise<EmailIdentity>, sender: {
408
- id: string;
409
- } | Promise<{
410
- id: string;
411
- }>): {
412
- send: (i: {
413
- data: Data;
378
+ };
379
+ }>;
380
+ };
381
+ email: {
382
+ send: Handler<UndefinedIsOptional<{
383
+ senderId: string;
384
+ emailIdentityId: string;
385
+ type: "email" | undefined;
414
386
  to: string[];
415
- }) => Promise<{
387
+ template: Record<string, any>;
388
+ content: UndefinedIsOptional<{
389
+ subject: string;
390
+ html: string;
391
+ text: string;
392
+ }>;
393
+ }>, {
416
394
  id: string;
395
+ }, {
396
+ sender: {} & {
397
+ name: string;
398
+ oid: number;
399
+ id: string;
400
+ createdAt: Date;
401
+ identifier: string;
402
+ };
417
403
  }>;
418
404
  };
419
- };
405
+ }>;
420
406
 
421
407
  export {
422
408
  Text$1 as Text,
@@ -1,2 +1,2 @@
1
- import{createClient as e}from"@lowerdeck/rpc-client";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{Section as r,Button as i,Text as o,Row as l,Column as a,Html as s,Head as c,Preview as d,Body as f,Container as p,Img as u,Hr as h,render as m}from"@react-email/components";import x from"react";function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y.apply(null,arguments)}var g={padding:"27px 0 27px",textAlign:"center"},v={backgroundColor:"#000000",borderRadius:"7px",fontWeight:"600",color:"#fff",fontSize:"15px",textDecoration:"none",textAlign:"center",display:"block"},b=function(e){var n=e.href,o=e.children;return t(r,{style:g,children:t(i,{style:y({},v,{padding:"12px 18px"}),href:n,children:o})})},S=function(e){var i=e.code,l=i.slice(0,3),a=i.slice(3,6);return t(r,{style:{background:"#fff",border:"1px solid #ddd",borderRadius:"8px",margin:"20px 0px",padding:"6px 15px"},children:n(o,{style:{fontSize:"20px",textAlign:"center",verticalAlign:"middle"},children:[t("span",{children:l}),t("span",{style:{margin:"0 5px",color:"#aaa"},children:"-"}),t("span",{children:a})]})})},I={},z=function(e){return t(r,{style:I,children:e.items.map(function(e,r){var i=e.value;return t(l,{children:n(a,{style:{padding:"10px 0px"},children:[n(o,{style:{fontSize:14,fontWeight:"bold",padding:"3px 0px",margin:0},children:[e.label,":"," "]}),t(o,{style:{fontSize:14,padding:"3px 0px",margin:0},children:i})]})},r)})})},j=function(e){var r=e.title,i=e.description,l=e.children,a=e.style;return n(x.Fragment,{children:[t(o,{style:y({fontFamily:"sans-serif",fontSize:20,fontWeight:"bold",marginBottom:10},a),children:r}),i&&t(o,{style:y({fontFamily:"sans-serif",fontSize:16,marginBottom:20},a),children:i}),l]})},P=function(e){var n=e.children;return t(o,{style:y({fontFamily:"sans-serif",fontSize:14},e.style),children:n})},k={backgroundColor:"#ffffff",margin:"0 auto",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif"},F={maxWidth:"600px",margin:"0 auto"},w={marginTop:"25px"},A={fontSize:"12px",color:"#777"},M={margin:"20px 0px",border:"none",borderBottom:"1px solid #ddd",background:"none"},O=function(e){var i=e.children,l=e.preview;return n(s,{children:[t(c,{}),l&&t(d,{children:l}),t(f,{style:k,children:n(p,{style:F,children:[t(r,{style:w,children:t(u,{src:"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png",height:"30",alt:"Metorial"})}),i,t(h,{style:M}),t(r,{children:"enterprise"==process.env.METORIAL_SOURCE?t(o,{style:A,children:"Sent by Metorial 💌. If you have any questions, feel free to contact us. If you need to reference this message use this ID: EMAIL_ID."}):n(o,{style:A,children:["Sent by a self hosted instance of ",t("a",{href:"https://metorial.com",children:"Metorial"}),". Contact the administrator of this instance if you have any questions."]})})]})})]})},T=function(e){var n=e.subject,r=t(O,{preview:e.preview,children:e.content});return{subject:n,html:m(r,{plainText:!1}),text:m(r,{plainText:!0})}},B=function(e){return e},C=function(t){var n=e(t);return{client:n,createTemplate:function(e,t,r){return{send:function(i){try{return Promise.resolve(e.render(i.data)).then(function(e){var o=n.email,l=o.send,a=i.data,s=i.to;return Promise.resolve(t).then(function(t){var n=t.id;return Promise.resolve(r).then(function(t){var r=t.id,i=e.subject;return Promise.resolve(e.html).then(function(t){return Promise.resolve(e.text).then(function(e){return Promise.resolve(l.call(o,{type:"email",to:s,template:a,emailIdentityId:n,senderId:r,content:{subject:i,html:t,text:e}}))})})})})})}catch(e){return Promise.reject(e)}}}}}};export{b as Button,S as Code,z as DataList,j as Layout,P as Text,O as Wrapper,T as createEmail,C as createRelayClient,B as createTemplate};
1
+ import{createClient as e}from"@lowerdeck/rpc-client";import{jsx as n,jsxs as t}from"react/jsx-runtime";import{Section as r,Button as i,Text as o,Row as l,Column as a,Html as c,Head as s,Preview as d,Body as p,Container as f,Img as h,Hr as u,render as m}from"@react-email/components";import x from"react";function g(){return g=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},g.apply(null,arguments)}var y={padding:"27px 0 27px",textAlign:"center"},b={backgroundColor:"#000000",borderRadius:"7px",fontWeight:"600",color:"#fff",fontSize:"15px",textDecoration:"none",textAlign:"center",display:"block"},v=function(e){var t=e.href,o=e.children;return n(r,{style:y,children:n(i,{style:g({},b,{padding:"12px 18px"}),href:t,children:o})})},S=function(e){var i=e.code,l=i.slice(0,3),a=i.slice(3,6);return n(r,{style:{background:"#fff",border:"1px solid #ddd",borderRadius:"8px",margin:"20px 0px",padding:"6px 15px"},children:t(o,{style:{fontSize:"20px",textAlign:"center",verticalAlign:"middle"},children:[n("span",{children:l}),n("span",{style:{margin:"0 5px",color:"#aaa"},children:"-"}),n("span",{children:a})]})})},z={},k=function(e){return n(r,{style:z,children:e.items.map(function(e,r){var i=e.value;return n(l,{children:t(a,{style:{padding:"10px 0px"},children:[t(o,{style:{fontSize:14,fontWeight:"bold",padding:"3px 0px",margin:0},children:[e.label,":"," "]}),n(o,{style:{fontSize:14,padding:"3px 0px",margin:0},children:i})]})},r)})})},F=function(e){var r=e.title,i=e.description,l=e.children,a=e.style;return t(x.Fragment,{children:[n(o,{style:g({fontFamily:"sans-serif",fontSize:20,fontWeight:"bold",marginBottom:10},a),children:r}),i&&n(o,{style:g({fontFamily:"sans-serif",fontSize:16,marginBottom:20},a),children:i}),l]})},I=function(e){var t=e.children;return n(o,{style:g({fontFamily:"sans-serif",fontSize:14},e.style),children:t})},w={backgroundColor:"#ffffff",margin:"0 auto",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif"},A={maxWidth:"600px",margin:"0 auto"},M={marginTop:"25px"},O={fontSize:"12px",color:"#777"},j={margin:"20px 0px",border:"none",borderBottom:"1px solid #ddd",background:"none"},B=function(e){var i=e.children,l=e.preview;return t(c,{children:[n(s,{}),l&&n(d,{children:l}),n(p,{style:w,children:t(f,{style:A,children:[n(r,{style:M,children:n(h,{src:"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png",height:"30",alt:"Metorial"})}),i,n(u,{style:j}),n(r,{children:"enterprise"==process.env.METORIAL_SOURCE?n(o,{style:O,children:"Sent by Metorial 💌. If you have any questions, feel free to contact us. If you need to reference this message use this ID: EMAIL_ID."}):t(o,{style:O,children:["Sent by a self hosted instance of ",n("a",{href:"https://metorial.com",children:"Metorial"}),". Contact the administrator of this instance if you have any questions."]})})]})})]})},C=function(e){var t=e.subject,r=n(B,{preview:e.preview,children:e.content});return{subject:t,html:m(r,{plainText:!1}),text:m(r,{plainText:!0})}},R=function(e){return e},T=function(n){return e(n)};export{v as Button,S as Code,k as DataList,F as Layout,I as Text,B as Wrapper,C as createEmail,T as createRelayClient,R as createTemplate};
2
2
  //# sourceMappingURL=index.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.module.js","sources":["../src/templates/components/button.tsx","../src/templates/components/code.tsx","../src/templates/components/dataList.tsx","../src/templates/components/layout.tsx","../src/templates/components/text.tsx","../src/templates/components/wrapper.tsx","../src/templates/lib/email.tsx","../src/templates/template.ts","../src/index.ts"],"sourcesContent":["import { Button as EmailButton, Section } from '@react-email/components';\nimport React from 'react';\n\nlet buttonContainer = {\n padding: '27px 0 27px',\n textAlign: 'center' as const\n};\n\nlet button = {\n backgroundColor: '#000000',\n borderRadius: '7px',\n fontWeight: '600',\n color: '#fff',\n fontSize: '15px',\n textDecoration: 'none',\n textAlign: 'center' as const,\n display: 'block'\n};\n\nexport let Button = ({ href, children }: { href: string; children: React.ReactNode }) => {\n return (\n <Section style={buttonContainer}>\n <EmailButton style={{ ...button, padding: '12px 18px' }} href={href}>\n {children as any}\n </EmailButton>\n </Section>\n );\n};\n","import { Section, Text } from '@react-email/components';\n\nexport let Code = ({ code }: { code: string }) => {\n let first3 = code.slice(0, 3);\n let last3 = code.slice(3, 6);\n\n return (\n <Section\n style={{\n background: '#fff',\n border: '1px solid #ddd',\n borderRadius: '8px',\n margin: '20px 0px',\n padding: '6px 15px'\n }}\n >\n <Text\n style={{\n fontSize: '20px',\n textAlign: 'center',\n verticalAlign: 'middle'\n }}\n >\n <span>{first3}</span>\n <span style={{ margin: '0 5px', color: '#aaa' }}>-</span>\n <span>{last3}</span>\n </Text>\n </Section>\n );\n};\n","import { Column, Row, Section, Text } from '@react-email/components';\n\nlet container = {\n // background: '#efefef',\n // border: '1px solid #ccc'\n};\n\nexport let DataList = ({ items }: { items: { label: string; value: string }[] }) => {\n return (\n <Section style={container}>\n {items.map(({ label, value }, i) => (\n <Row key={i}>\n <Column style={{ padding: '10px 0px' }}>\n <Text style={{ fontSize: 14, fontWeight: 'bold', padding: '3px 0px', margin: 0 }}>\n {label}:{' '}\n </Text>\n <Text style={{ fontSize: 14, padding: '3px 0px', margin: 0 }}>{value}</Text>\n </Column>\n </Row>\n ))}\n </Section>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Layout = ({\n title,\n description,\n children,\n style\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <React.Fragment>\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 20,\n fontWeight: 'bold',\n marginBottom: 10,\n ...style\n }}\n >\n {title}\n </EmailText>\n\n {description && (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 16,\n marginBottom: 20,\n ...style\n }}\n >\n {description}\n </EmailText>\n )}\n\n {children}\n </React.Fragment>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Text = ({\n children,\n style\n}: {\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 14,\n ...style\n }}\n >\n {children}\n </EmailText>\n );\n};\n","import {\n Body,\n Container,\n Head,\n Hr,\n Html,\n Img,\n Preview,\n Section,\n Text\n} from '@react-email/components';\nimport React from 'react';\n\nlet main = {\n backgroundColor: '#ffffff',\n margin: '0 auto',\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif\"\n};\n\nlet container = {\n maxWidth: '600px',\n margin: '0 auto'\n};\n\nlet logoContainer = {\n marginTop: '25px'\n};\n\nlet footerText = {\n fontSize: '12px',\n color: '#777'\n};\n\nlet hr = {\n margin: '20px 0px',\n border: 'none',\n borderBottom: '1px solid #ddd',\n background: 'none'\n};\n\nexport let Wrapper = ({\n children,\n preview\n}: {\n children?: React.ReactNode;\n preview?: string;\n}) => {\n return (\n <Html>\n <Head />\n\n {preview && <Preview>{preview}</Preview>}\n\n <Body style={main}>\n <Container style={container}>\n <Section style={logoContainer}>\n <Img\n src=\"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png\"\n height=\"30\"\n alt=\"Metorial\"\n />\n </Section>\n\n {children}\n\n <Hr style={hr} />\n\n <Section>\n {process.env.METORIAL_SOURCE == 'enterprise' ? (\n <Text style={footerText}>\n Sent by Metorial 💌. If you have any questions, feel free to contact us. If you\n need to reference this message use this ID: EMAIL_ID.\n </Text>\n ) : (\n <Text style={footerText}>\n Sent by a self hosted instance of <a href=\"https://metorial.com\">Metorial</a>.\n Contact the administrator of this instance if you have any questions.\n </Text>\n )}\n </Section>\n </Container>\n </Body>\n </Html>\n );\n};\n","import { render } from '@react-email/components';\nimport React from 'react';\nimport { Wrapper } from '../components/wrapper';\n\nexport interface IEmail {\n subject: string;\n html: string | Promise<string>;\n text: string | Promise<string>;\n}\n\nexport let createEmail = ({\n content,\n preview,\n subject\n}: {\n content: React.ReactElement;\n preview?: string;\n subject: string;\n}) => {\n let inner = <Wrapper preview={preview}>{content}</Wrapper>;\n\n let html = render(inner, { plainText: false });\n let text = render(inner, { plainText: true });\n\n return {\n subject,\n html,\n text\n };\n};\n","import { IEmail } from './lib/email';\n\nexport interface ITemplate<Data> {\n render: (data: Data) => IEmail | Promise<IEmail>;\n}\n\nexport let createTemplate = <Data>(template: ITemplate<Data>) => template;\n","import { createClient } from '@lowerdeck/rpc-client';\nimport type { RelayClient } from '../../../service/src/controllers';\nimport { ITemplate } from './templates';\n\nexport * from './templates';\n\ntype ClientOpts = Parameters<typeof createClient>[0];\n\ntype EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;\n\nexport let createRelayClient = (o: ClientOpts) => {\n let inner = createClient<RelayClient>(o);\n\n return {\n client: inner,\n\n createTemplate<Data>(\n template: ITemplate<Data>,\n identity: EmailIdentity | Promise<EmailIdentity>,\n sender: { id: string } | Promise<{ id: string }>\n ) {\n return {\n send: async (i: { data: Data; to: string[] }) => {\n let rendered = await template.render(i.data);\n\n return await inner.email.send({\n type: 'email',\n to: i.to,\n template: i.data as any,\n\n emailIdentityId: (await identity).id,\n senderId: (await sender).id,\n\n content: {\n subject: rendered.subject,\n html: await rendered.html,\n text: await rendered.text\n }\n });\n }\n };\n }\n };\n};\n"],"names":["buttonContainer","padding","textAlign","button","backgroundColor","borderRadius","fontWeight","color","fontSize","textDecoration","display","Button","_ref","href","children","_jsx","Section","style","EmailButton","_extends","Code","code","first3","slice","last3","background","border","margin","_jsxs","Text","verticalAlign","container","DataList","items","map","_ref2","i","value","Row","Column","label","Layout","title","description","React","Fragment","EmailText","fontFamily","marginBottom","main","maxWidth","logoContainer","marginTop","footerText","hr","borderBottom","Wrapper","preview","Html","Head","Preview","Body","Container","Img","src","height","alt","Hr","process","env","METORIAL_SOURCE","createEmail","subject","inner","content","html","render","plainText","text","createTemplate","template","createRelayClient","o","createClient","client","identity","sender","send","Promise","resolve","data","then","rendered","_inner$email","email","_send","_i$data","_i$to","to","_identity","_identity$id","id","_sender","_sender$id","_rendered$subject","_rendered$html","_rendered$text","call","type","emailIdentityId","senderId","e","reject"],"mappings":"wgBAGA,IAAIA,EAAkB,CACpBC,QAAS,cACTC,UAAW,UAGTC,EAAS,CACXC,gBAAiB,UACjBC,aAAc,MACdC,WAAY,MACZC,MAAO,OACPC,SAAU,OACVC,eAAgB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UAAAvB,QAAAwB,OAAAD,EAAA,CAAA,EAEL,EAEJ"}
1
+ {"version":3,"file":"index.module.js","sources":["../src/templates/components/button.tsx","../src/templates/components/code.tsx","../src/templates/components/dataList.tsx","../src/templates/components/layout.tsx","../src/templates/components/text.tsx","../src/templates/components/wrapper.tsx","../src/templates/lib/email.tsx","../src/templates/template.ts","../src/index.ts"],"sourcesContent":["import { Button as EmailButton, Section } from '@react-email/components';\nimport React from 'react';\n\nlet buttonContainer = {\n padding: '27px 0 27px',\n textAlign: 'center' as const\n};\n\nlet button = {\n backgroundColor: '#000000',\n borderRadius: '7px',\n fontWeight: '600',\n color: '#fff',\n fontSize: '15px',\n textDecoration: 'none',\n textAlign: 'center' as const,\n display: 'block'\n};\n\nexport let Button = ({ href, children }: { href: string; children: React.ReactNode }) => {\n return (\n <Section style={buttonContainer}>\n <EmailButton style={{ ...button, padding: '12px 18px' }} href={href}>\n {children as any}\n </EmailButton>\n </Section>\n );\n};\n","import { Section, Text } from '@react-email/components';\n\nexport let Code = ({ code }: { code: string }) => {\n let first3 = code.slice(0, 3);\n let last3 = code.slice(3, 6);\n\n return (\n <Section\n style={{\n background: '#fff',\n border: '1px solid #ddd',\n borderRadius: '8px',\n margin: '20px 0px',\n padding: '6px 15px'\n }}\n >\n <Text\n style={{\n fontSize: '20px',\n textAlign: 'center',\n verticalAlign: 'middle'\n }}\n >\n <span>{first3}</span>\n <span style={{ margin: '0 5px', color: '#aaa' }}>-</span>\n <span>{last3}</span>\n </Text>\n </Section>\n );\n};\n","import { Column, Row, Section, Text } from '@react-email/components';\n\nlet container = {\n // background: '#efefef',\n // border: '1px solid #ccc'\n};\n\nexport let DataList = ({ items }: { items: { label: string; value: string }[] }) => {\n return (\n <Section style={container}>\n {items.map(({ label, value }, i) => (\n <Row key={i}>\n <Column style={{ padding: '10px 0px' }}>\n <Text style={{ fontSize: 14, fontWeight: 'bold', padding: '3px 0px', margin: 0 }}>\n {label}:{' '}\n </Text>\n <Text style={{ fontSize: 14, padding: '3px 0px', margin: 0 }}>{value}</Text>\n </Column>\n </Row>\n ))}\n </Section>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Layout = ({\n title,\n description,\n children,\n style\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <React.Fragment>\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 20,\n fontWeight: 'bold',\n marginBottom: 10,\n ...style\n }}\n >\n {title}\n </EmailText>\n\n {description && (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 16,\n marginBottom: 20,\n ...style\n }}\n >\n {description}\n </EmailText>\n )}\n\n {children}\n </React.Fragment>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Text = ({\n children,\n style\n}: {\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 14,\n ...style\n }}\n >\n {children}\n </EmailText>\n );\n};\n","import {\n Body,\n Container,\n Head,\n Hr,\n Html,\n Img,\n Preview,\n Section,\n Text\n} from '@react-email/components';\nimport React from 'react';\n\nlet main = {\n backgroundColor: '#ffffff',\n margin: '0 auto',\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif\"\n};\n\nlet container = {\n maxWidth: '600px',\n margin: '0 auto'\n};\n\nlet logoContainer = {\n marginTop: '25px'\n};\n\nlet footerText = {\n fontSize: '12px',\n color: '#777'\n};\n\nlet hr = {\n margin: '20px 0px',\n border: 'none',\n borderBottom: '1px solid #ddd',\n background: 'none'\n};\n\nexport let Wrapper = ({\n children,\n preview\n}: {\n children?: React.ReactNode;\n preview?: string;\n}) => {\n return (\n <Html>\n <Head />\n\n {preview && <Preview>{preview}</Preview>}\n\n <Body style={main}>\n <Container style={container}>\n <Section style={logoContainer}>\n <Img\n src=\"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png\"\n height=\"30\"\n alt=\"Metorial\"\n />\n </Section>\n\n {children}\n\n <Hr style={hr} />\n\n <Section>\n {process.env.METORIAL_SOURCE == 'enterprise' ? (\n <Text style={footerText}>\n Sent by Metorial 💌. If you have any questions, feel free to contact us. If you\n need to reference this message use this ID: EMAIL_ID.\n </Text>\n ) : (\n <Text style={footerText}>\n Sent by a self hosted instance of <a href=\"https://metorial.com\">Metorial</a>.\n Contact the administrator of this instance if you have any questions.\n </Text>\n )}\n </Section>\n </Container>\n </Body>\n </Html>\n );\n};\n","import { render } from '@react-email/components';\nimport React from 'react';\nimport { Wrapper } from '../components/wrapper';\n\nexport interface IEmail {\n subject: string;\n html: string | Promise<string>;\n text: string | Promise<string>;\n}\n\nexport let createEmail = ({\n content,\n preview,\n subject\n}: {\n content: React.ReactElement;\n preview?: string;\n subject: string;\n}) => {\n let inner = <Wrapper preview={preview}>{content}</Wrapper>;\n\n let html = render(inner, { plainText: false });\n let text = render(inner, { plainText: true });\n\n return {\n subject,\n html,\n text\n };\n};\n","import { IEmail } from './lib/email';\n\nexport interface ITemplate<Data> {\n render: (data: Data) => IEmail | Promise<IEmail>;\n}\n\nexport let createTemplate = <Data>(template: ITemplate<Data>) => template;\n","import { createClient } from '@lowerdeck/rpc-client';\nimport type { RelayClient } from '../../../service/src/controllers';\n\nexport * from './templates';\n\ntype ClientOpts = Parameters<typeof createClient>[0];\n\nexport type EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;\n\nexport let createRelayClient = (o: ClientOpts) => {\n let inner = createClient<RelayClient>(o);\n\n return inner;\n};\n"],"names":["buttonContainer","padding","textAlign","button","backgroundColor","borderRadius","fontWeight","color","fontSize","textDecoration","display","Button","_ref","href","children","_jsx","Section","style","EmailButton","_extends","Code","code","first3","slice","last3","background","border","margin","_jsxs","Text","verticalAlign","container","DataList","items","map","_ref2","i","value","Row","Column","label","Layout","title","description","React","Fragment","EmailText","fontFamily","marginBottom","main","maxWidth","logoContainer","marginTop","footerText","hr","borderBottom","Wrapper","preview","Html","Head","Preview","Body","Container","Img","src","height","alt","Hr","process","env","METORIAL_SOURCE","createEmail","subject","inner","content","html","render","plainText","text","createTemplate","template","createRelayClient","o","createClient"],"mappings":"wgBAGA,IAAIA,EAAkB,CACpBC,QAAS,cACTC,UAAW,UAGTC,EAAS,CACXC,gBAAiB,UACjBC,aAAc,MACdC,WAAY,MACZC,MAAO,OACPC,SAAU,OACVC,eAAgB,OAChBP,UAAW,SACXQ,QAAS,SAGAC,EAAS,SAAHC,GAAuE,IAAjEC,EAAID,EAAJC,KAAMC,EAAQF,EAARE,SAC3B,OACEC,EAACC,EAAO,CAACC,MAAOjB,EAAec,SAC7BC,EAACG,EAAY,CAAAD,MAAKE,EAAA,CAAA,EAAOhB,EAAQF,CAAAA,QAAS,cAAeY,KAAMA,EAC5DC,SAAAA,KAIT,ECzBWM,EAAO,SAAHR,GAAM,IAAAS,EAAIT,EAAJS,KACfC,EAASD,EAAKE,MAAM,EAAG,GACvBC,EAAQH,EAAKE,MAAM,EAAG,GAE1B,OACER,EAACC,EAAO,CACNC,MAAO,CACLQ,WAAY,OACZC,OAAQ,iBACRrB,aAAc,MACdsB,OAAQ,WACR1B,QAAS,YACVa,SAEDc,EAACC,EACC,CAAAZ,MAAO,CACLT,SAAU,OACVN,UAAW,SACX4B,cAAe,UAGjBhB,SAAA,CAAAC,EAAA,OAAA,CAAAD,SAAOQ,IACPP,EAAA,OAAA,CAAME,MAAO,CAAEU,OAAQ,QAASpB,MAAO,QAAQO,SAAA,MAC/CC,EAAA,OAAA,CAAAD,SAAOU,QAIf,EC3BIO,EAAY,CAGf,EAEUC,EAAW,SAAHpB,GACjB,OACEG,EAACC,EAAO,CAACC,MAAOc,WAFUnB,EAALqB,MAGZC,IAAI,SAAAC,EAAmBC,OAATC,E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O,CAAA,GAEPF,GAAW1C,EAAC6C,YAASH,IAEtB1C,EAAC8C,EAAI,CAAC5C,MAAOgC,EACXnC,SAAAc,EAACkC,EAAS,CAAC7C,MAAOc,EAChBjB,SAAA,CAAAC,EAACC,EAAO,CAACC,MAAOkC,EACdrC,SAAAC,EAACgD,EAAG,CACFC,IAAI,2GACJC,OAAO,KACPC,IAAI,eAIPpD,EAEDC,EAACoD,EAAE,CAAClD,MAAOqC,IAEXvC,EAACC,EACE,CAAAF,SAA+B,cAA/BsD,QAAQC,IAAIC,gBACXvD,EAACc,EAAK,CAAAZ,MAAOoC,EAAUvC,SAAA,0IAKvBc,EAACC,EAAK,CAAAZ,MAAOoC,iDACuBtC,EAAG,IAAA,CAAAF,KAAK,uBAAmCC,SAAA,aAAA,sFAS7F,EC3EWyD,EAAc,SAAH3D,GACpB,IAEA4D,EAAO5D,EAAP4D,QAMIC,EAAQ1D,EAACyC,EAAO,CAACC,QAPd7C,EAAP6C,QAOqC3C,SAR9BF,EAAP8D,UAaA,MAAO,CACLF,QAAAA,EACAG,KALSC,EAAOH,EAAO,CAAEI,WAAW,IAMpCC,KALSF,EAAOH,EAAO,CAAEI,WAAW,IAOxC,ECvBWE,EAAiB,SAAOC,GAA8B,OAAAA,CAAQ,ECG9DC,EAAoB,SAACC,GAG9B,OAFYC,EAA0BD,EAGxC"}
package/dist/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lowerdeck/rpc-client"),require("react/jsx-runtime"),require("@react-email/components"),require("react")):"function"==typeof define&&define.amd?define(["exports","@lowerdeck/rpc-client","react/jsx-runtime","@react-email/components","react"],t):t((e||self).relayClient={},e.rpcClient,e.jsxRuntime,e.components,e.react)}(this,function(e,t,n,r,i){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=/*#__PURE__*/o(i);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(null,arguments)}var a={padding:"27px 0 27px",textAlign:"center"},c={backgroundColor:"#000000",borderRadius:"7px",fontWeight:"600",color:"#fff",fontSize:"15px",textDecoration:"none",textAlign:"center",display:"block"},d={},u={backgroundColor:"#ffffff",margin:"0 auto",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif"},f={maxWidth:"600px",margin:"0 auto"},x={marginTop:"25px"},p={fontSize:"12px",color:"#777"},h={margin:"20px 0px",border:"none",borderBottom:"1px solid #ddd",background:"none"},m=function(e){var t=e.children,i=e.preview;return n.jsxs(r.Html,{children:[n.jsx(r.Head,{}),i&&n.jsx(r.Preview,{children:i}),n.jsx(r.Body,{style:u,children:n.jsxs(r.Container,{style:f,children:[n.jsx(r.Section,{style:x,children:n.jsx(r.Img,{src:"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png",height:"30",alt:"Metorial"})}),t,n.jsx(r.Hr,{style:h}),n.jsx(r.Section,{children:"enterprise"==process.env.METORIAL_SOURCE?n.jsx(r.Text,{style:p,children:"Sent by Metorial 💌. If you have any questions, feel free to contact us. If you need to reference this message use this ID: EMAIL_ID."}):n.jsxs(r.Text,{style:p,children:["Sent by a self hosted instance of ",n.jsx("a",{href:"https://metorial.com",children:"Metorial"}),". Contact the administrator of this instance if you have any questions."]})})]})})]})};e.Button=function(e){var t=e.href,i=e.children;return n.jsx(r.Section,{style:a,children:n.jsx(r.Button,{style:l({},c,{padding:"12px 18px"}),href:t,children:i})})},e.Code=function(e){var t=e.code,i=t.slice(0,3),o=t.slice(3,6);return n.jsx(r.Section,{style:{background:"#fff",border:"1px solid #ddd",borderRadius:"8px",margin:"20px 0px",padding:"6px 15px"},children:n.jsxs(r.Text,{style:{fontSize:"20px",textAlign:"center",verticalAlign:"middle"},children:[n.jsx("span",{children:i}),n.jsx("span",{style:{margin:"0 5px",color:"#aaa"},children:"-"}),n.jsx("span",{children:o})]})})},e.DataList=function(e){return n.jsx(r.Section,{style:d,children:e.items.map(function(e,t){var i=e.value;return n.jsx(r.Row,{children:n.jsxs(r.Column,{style:{padding:"10px 0px"},children:[n.jsxs(r.Text,{style:{fontSize:14,fontWeight:"bold",padding:"3px 0px",margin:0},children:[e.label,":"," "]}),n.jsx(r.Text,{style:{fontSize:14,padding:"3px 0px",margin:0},children:i})]})},t)})})},e.Layout=function(e){var t=e.title,i=e.description,o=e.children,a=e.style;return n.jsxs(s.default.Fragment,{children:[n.jsx(r.Text,{style:l({fontFamily:"sans-serif",fontSize:20,fontWeight:"bold",marginBottom:10},a),children:t}),i&&n.jsx(r.Text,{style:l({fontFamily:"sans-serif",fontSize:16,marginBottom:20},a),children:i}),o]})},e.Text=function(e){var t=e.children;return n.jsx(r.Text,{style:l({fontFamily:"sans-serif",fontSize:14},e.style),children:t})},e.Wrapper=m,e.createEmail=function(e){var t=e.subject,i=n.jsx(m,{preview:e.preview,children:e.content});return{subject:t,html:r.render(i,{plainText:!1}),text:r.render(i,{plainText:!0})}},e.createRelayClient=function(e){var n=t.createClient(e);return{client:n,createTemplate:function(e,t,r){return{send:function(i){try{return Promise.resolve(e.render(i.data)).then(function(e){var o=n.email,s=o.send,l=i.data,a=i.to;return Promise.resolve(t).then(function(t){var n=t.id;return Promise.resolve(r).then(function(t){var r=t.id,i=e.subject;return Promise.resolve(e.html).then(function(t){return Promise.resolve(e.text).then(function(e){return Promise.resolve(s.call(o,{type:"email",to:a,template:l,emailIdentityId:n,senderId:r,content:{subject:i,html:t,text:e}}))})})})})})}catch(e){return Promise.reject(e)}}}}}},e.createTemplate=function(e){return e}});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lowerdeck/rpc-client"),require("react/jsx-runtime"),require("@react-email/components"),require("react")):"function"==typeof define&&define.amd?define(["exports","@lowerdeck/rpc-client","react/jsx-runtime","@react-email/components","react"],t):t((e||self).relayClient={},e.rpcClient,e.jsxRuntime,e.components,e.react)}(this,function(e,t,n,r,i){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=/*#__PURE__*/o(i);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(null,arguments)}var a={padding:"27px 0 27px",textAlign:"center"},c={backgroundColor:"#000000",borderRadius:"7px",fontWeight:"600",color:"#fff",fontSize:"15px",textDecoration:"none",textAlign:"center",display:"block"},d={},x={backgroundColor:"#ffffff",margin:"0 auto",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif"},f={maxWidth:"600px",margin:"0 auto"},p={marginTop:"25px"},u={fontSize:"12px",color:"#777"},h={margin:"20px 0px",border:"none",borderBottom:"1px solid #ddd",background:"none"},m=function(e){var t=e.children,i=e.preview;return n.jsxs(r.Html,{children:[n.jsx(r.Head,{}),i&&n.jsx(r.Preview,{children:i}),n.jsx(r.Body,{style:x,children:n.jsxs(r.Container,{style:f,children:[n.jsx(r.Section,{style:p,children:n.jsx(r.Img,{src:"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png",height:"30",alt:"Metorial"})}),t,n.jsx(r.Hr,{style:h}),n.jsx(r.Section,{children:"enterprise"==process.env.METORIAL_SOURCE?n.jsx(r.Text,{style:u,children:"Sent by Metorial 💌. If you have any questions, feel free to contact us. If you need to reference this message use this ID: EMAIL_ID."}):n.jsxs(r.Text,{style:u,children:["Sent by a self hosted instance of ",n.jsx("a",{href:"https://metorial.com",children:"Metorial"}),". Contact the administrator of this instance if you have any questions."]})})]})})]})};e.Button=function(e){var t=e.href,i=e.children;return n.jsx(r.Section,{style:a,children:n.jsx(r.Button,{style:l({},c,{padding:"12px 18px"}),href:t,children:i})})},e.Code=function(e){var t=e.code,i=t.slice(0,3),o=t.slice(3,6);return n.jsx(r.Section,{style:{background:"#fff",border:"1px solid #ddd",borderRadius:"8px",margin:"20px 0px",padding:"6px 15px"},children:n.jsxs(r.Text,{style:{fontSize:"20px",textAlign:"center",verticalAlign:"middle"},children:[n.jsx("span",{children:i}),n.jsx("span",{style:{margin:"0 5px",color:"#aaa"},children:"-"}),n.jsx("span",{children:o})]})})},e.DataList=function(e){return n.jsx(r.Section,{style:d,children:e.items.map(function(e,t){var i=e.value;return n.jsx(r.Row,{children:n.jsxs(r.Column,{style:{padding:"10px 0px"},children:[n.jsxs(r.Text,{style:{fontSize:14,fontWeight:"bold",padding:"3px 0px",margin:0},children:[e.label,":"," "]}),n.jsx(r.Text,{style:{fontSize:14,padding:"3px 0px",margin:0},children:i})]})},t)})})},e.Layout=function(e){var t=e.title,i=e.description,o=e.children,a=e.style;return n.jsxs(s.default.Fragment,{children:[n.jsx(r.Text,{style:l({fontFamily:"sans-serif",fontSize:20,fontWeight:"bold",marginBottom:10},a),children:t}),i&&n.jsx(r.Text,{style:l({fontFamily:"sans-serif",fontSize:16,marginBottom:20},a),children:i}),o]})},e.Text=function(e){var t=e.children;return n.jsx(r.Text,{style:l({fontFamily:"sans-serif",fontSize:14},e.style),children:t})},e.Wrapper=m,e.createEmail=function(e){var t=e.subject,i=n.jsx(m,{preview:e.preview,children:e.content});return{subject:t,html:r.render(i,{plainText:!1}),text:r.render(i,{plainText:!0})}},e.createRelayClient=function(e){return t.createClient(e)},e.createTemplate=function(e){return e}});
2
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/templates/components/button.tsx","../src/templates/components/dataList.tsx","../src/templates/components/wrapper.tsx","../src/templates/components/code.tsx","../src/templates/components/layout.tsx","../src/templates/components/text.tsx","../src/templates/lib/email.tsx","../src/index.ts","../src/templates/template.ts"],"sourcesContent":["import { Button as EmailButton, Section } from '@react-email/components';\nimport React from 'react';\n\nlet buttonContainer = {\n padding: '27px 0 27px',\n textAlign: 'center' as const\n};\n\nlet button = {\n backgroundColor: '#000000',\n borderRadius: '7px',\n fontWeight: '600',\n color: '#fff',\n fontSize: '15px',\n textDecoration: 'none',\n textAlign: 'center' as const,\n display: 'block'\n};\n\nexport let Button = ({ href, children }: { href: string; children: React.ReactNode }) => {\n return (\n <Section style={buttonContainer}>\n <EmailButton style={{ ...button, padding: '12px 18px' }} href={href}>\n {children as any}\n </EmailButton>\n </Section>\n );\n};\n","import { Column, Row, Section, Text } from '@react-email/components';\n\nlet container = {\n // background: '#efefef',\n // border: '1px solid #ccc'\n};\n\nexport let DataList = ({ items }: { items: { label: string; value: string }[] }) => {\n return (\n <Section style={container}>\n {items.map(({ label, value }, i) => (\n <Row key={i}>\n <Column style={{ padding: '10px 0px' }}>\n <Text style={{ fontSize: 14, fontWeight: 'bold', padding: '3px 0px', margin: 0 }}>\n {label}:{' '}\n </Text>\n <Text style={{ fontSize: 14, padding: '3px 0px', margin: 0 }}>{value}</Text>\n </Column>\n </Row>\n ))}\n </Section>\n );\n};\n","import {\n Body,\n Container,\n Head,\n Hr,\n Html,\n Img,\n Preview,\n Section,\n Text\n} from '@react-email/components';\nimport React from 'react';\n\nlet main = {\n backgroundColor: '#ffffff',\n margin: '0 auto',\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif\"\n};\n\nlet container = {\n maxWidth: '600px',\n margin: '0 auto'\n};\n\nlet logoContainer = {\n marginTop: '25px'\n};\n\nlet footerText = {\n fontSize: '12px',\n color: '#777'\n};\n\nlet hr = {\n margin: '20px 0px',\n border: 'none',\n borderBottom: '1px solid #ddd',\n background: 'none'\n};\n\nexport let Wrapper = ({\n children,\n preview\n}: {\n children?: React.ReactNode;\n preview?: string;\n}) => {\n return (\n <Html>\n <Head />\n\n {preview && <Preview>{preview}</Preview>}\n\n <Body style={main}>\n <Container style={container}>\n <Section style={logoContainer}>\n <Img\n src=\"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png\"\n height=\"30\"\n alt=\"Metorial\"\n />\n </Section>\n\n {children}\n\n <Hr style={hr} />\n\n <Section>\n {process.env.METORIAL_SOURCE == 'enterprise' ? (\n <Text style={footerText}>\n Sent by Metorial 💌. If you have any questions, feel free to contact us. If you\n need to reference this message use this ID: EMAIL_ID.\n </Text>\n ) : (\n <Text style={footerText}>\n Sent by a self hosted instance of <a href=\"https://metorial.com\">Metorial</a>.\n Contact the administrator of this instance if you have any questions.\n </Text>\n )}\n </Section>\n </Container>\n </Body>\n </Html>\n );\n};\n","import { Section, Text } from '@react-email/components';\n\nexport let Code = ({ code }: { code: string }) => {\n let first3 = code.slice(0, 3);\n let last3 = code.slice(3, 6);\n\n return (\n <Section\n style={{\n background: '#fff',\n border: '1px solid #ddd',\n borderRadius: '8px',\n margin: '20px 0px',\n padding: '6px 15px'\n }}\n >\n <Text\n style={{\n fontSize: '20px',\n textAlign: 'center',\n verticalAlign: 'middle'\n }}\n >\n <span>{first3}</span>\n <span style={{ margin: '0 5px', color: '#aaa' }}>-</span>\n <span>{last3}</span>\n </Text>\n </Section>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Layout = ({\n title,\n description,\n children,\n style\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <React.Fragment>\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 20,\n fontWeight: 'bold',\n marginBottom: 10,\n ...style\n }}\n >\n {title}\n </EmailText>\n\n {description && (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 16,\n marginBottom: 20,\n ...style\n }}\n >\n {description}\n </EmailText>\n )}\n\n {children}\n </React.Fragment>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Text = ({\n children,\n style\n}: {\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 14,\n ...style\n }}\n >\n {children}\n </EmailText>\n );\n};\n","import { render } from '@react-email/components';\nimport React from 'react';\nimport { Wrapper } from '../components/wrapper';\n\nexport interface IEmail {\n subject: string;\n html: string | Promise<string>;\n text: string | Promise<string>;\n}\n\nexport let createEmail = ({\n content,\n preview,\n subject\n}: {\n content: React.ReactElement;\n preview?: string;\n subject: string;\n}) => {\n let inner = <Wrapper preview={preview}>{content}</Wrapper>;\n\n let html = render(inner, { plainText: false });\n let text = render(inner, { plainText: true });\n\n return {\n subject,\n html,\n text\n };\n};\n","import { createClient } from '@lowerdeck/rpc-client';\nimport type { RelayClient } from '../../../service/src/controllers';\nimport { ITemplate } from './templates';\n\nexport * from './templates';\n\ntype ClientOpts = Parameters<typeof createClient>[0];\n\ntype EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;\n\nexport let createRelayClient = (o: ClientOpts) => {\n let inner = createClient<RelayClient>(o);\n\n return {\n client: inner,\n\n createTemplate<Data>(\n template: ITemplate<Data>,\n identity: EmailIdentity | Promise<EmailIdentity>,\n sender: { id: string } | Promise<{ id: string }>\n ) {\n return {\n send: async (i: { data: Data; to: string[] }) => {\n let rendered = await template.render(i.data);\n\n return await inner.email.send({\n type: 'email',\n to: i.to,\n template: i.data as any,\n\n emailIdentityId: (await identity).id,\n senderId: (await sender).id,\n\n content: {\n subject: rendered.subject,\n html: await rendered.html,\n text: await rendered.text\n }\n });\n }\n };\n }\n };\n};\n","import { IEmail } from './lib/email';\n\nexport interface ITemplate<Data> {\n render: (data: Data) => IEmail | Promise<IEmail>;\n}\n\nexport let createTemplate = <Data>(template: ITemplate<Data>) => template;\n"],"names":["buttonContainer","padding","textAlign","button","backgroundColor","borderRadius","fontWeight","color","fontSize","textDecoration","display","container","main","margin","fontFamily","maxWidth","logoContainer","marginTop","footerText","hr","border","borderBottom","background","Wrapper","_ref","children","preview","_jsxs","Html","_jsx","Head","Preview","jsx","Body","style","jsxs","Container","Section","Img","src","height","alt","Hr","process","env","METORIAL_SOURCE","Text","href","EmailButton","_extends","code","first3","slice","last3","verticalAlign","items","map","_ref2","i","value","Row","Column","label","title","description","React","Fragment","EmailText","marginBottom","subject","inner","content","html","render","plainText","text","o","createClient","client","createTemplate","template","identity","sender","send","Promise","resolve","data","then","rendered","_inner$email","email","_send","_i$data","_i$to","to","_identity","_identity$id","id","_sender","_sender$id","_rendered$subject","_rendered$html","_rendered$text","call","type","emailIdentityId","senderId","e","reject"],"mappings":"mxBAGA,IAAIA,EAAkB,CACpBC,QAAS,cACTC,UAAW,UAGTC,EAAS,CACXC,gBAAiB,UACjBC,aAAc,MACdC,WAAY,MACZC,MAAO,OACPC,SAAU,OACVC,eAAgB,OAChBP,UAAW,SACXQ,QAAS,SCdPC,EAAY,CAGf,ECQGC,EAAO,CACTR,gBAAiB,UACjBS,OAAQ,SACRC,WACE,qJAGAH,EAAY,CACdI,SAAU,QACVF,OAAQ,UAGNG,EAAgB,CAClBC,UAAW,QAGTC,EAAa,CACfV,SAAU,OACVD,MAAO,QAGLY,EAAK,CACPN,OAAQ,WACRO,OAAQ,OACRC,aAAc,iBACdC,WAAY,QAGHC,EAAU,SAAHC,GAChB,IAAAC,EAAQD,EAARC,SACAC,EAAOF,EAAPE,QAKA,OACEC,OAACC,EAAAA,KACC,CAAAH,SAAA,CAAAI,EAAAA,IAACC,EAAAA,KAAO,CAAA,GAEPJ,GAAWG,MAACE,EAAAA,kBAASL,IAEtBG,EAAAG,IAACC,EAAIA,KAAA,CAACC,MAAOtB,EACXa,SAAAE,EAAAQ,KAACC,EAASA,UAAA,CAACF,MAAOvB,EAChBc,SAAA,CAAAI,EAAAG,IAACK,EAAOA,QA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AA,OAAOH,EAAO,CAAEI,WAAW,IAOxC,sBCnB+B,SAACE,GAC9B,IAAIN,EAAQO,EAAYA,aAAcD,GAEtC,MAAO,CACLE,OAAQR,EAERS,eAAc,SACZC,EACAC,EACAC,GAEA,MAAO,CACLC,KAAI,SAASzB,GAAmC,IAAA,OAAA0B,QAAAC,QACzBL,EAASP,OAAOf,EAAE4B,OAAKC,cAAxCC,GAAQ,IAAAC,EAECnB,EAAMoB,MAAKC,EAAXF,EAAYN,KAAIS,EAGjBlC,EAAE4B,KAAWO,EADnBnC,EAAEoC,GAAEV,OAAAA,QAAAC,QAGgBJ,GAAQM,KAAA,SAAAQ,GAAAC,IAAAA,EAAfD,EAAiBE,UAAEb,QAAAC,QACnBH,GAAMK,KAAAW,SAAAA,GAAAC,IAAAA,EAAbD,EAAeD,GAAEG,EAGhBZ,EAASnB,QAAOe,OAAAA,QAAAC,QACbG,EAAShB,MAAIe,KAAA,SAAAc,GAAA,OAAAjB,QAAAC,QACbG,EAASb,MAAIY,KAAA,SAAAe,GAAA,OAAAlB,QAAAC,QAAAM,EAAAY,KAAAd,EAXC,CAC5Be,KAAM,QACNV,GAAED,EACFb,SAAQY,EAERa,gBAAeT,EACfU,SAAQP,EAER5B,QAAS,CACPF,QAAO+B,EACP5B,KAAI6B,EACJ1B,KAAI2B,KAGV,EAAA,EAAA,EAAA,EAAA,EAAA,CAAC,MAAAK,UAAAvB,QAAAwB,OAAAD,EAAA,CAAA,EAEL,EAEJ,mBCrC4B,SAAO3B,GAA8B,OAAAA,CAAQ"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/templates/components/button.tsx","../src/templates/components/dataList.tsx","../src/templates/components/wrapper.tsx","../src/templates/components/code.tsx","../src/templates/components/layout.tsx","../src/templates/components/text.tsx","../src/templates/lib/email.tsx","../src/index.ts","../src/templates/template.ts"],"sourcesContent":["import { Button as EmailButton, Section } from '@react-email/components';\nimport React from 'react';\n\nlet buttonContainer = {\n padding: '27px 0 27px',\n textAlign: 'center' as const\n};\n\nlet button = {\n backgroundColor: '#000000',\n borderRadius: '7px',\n fontWeight: '600',\n color: '#fff',\n fontSize: '15px',\n textDecoration: 'none',\n textAlign: 'center' as const,\n display: 'block'\n};\n\nexport let Button = ({ href, children }: { href: string; children: React.ReactNode }) => {\n return (\n <Section style={buttonContainer}>\n <EmailButton style={{ ...button, padding: '12px 18px' }} href={href}>\n {children as any}\n </EmailButton>\n </Section>\n );\n};\n","import { Column, Row, Section, Text } from '@react-email/components';\n\nlet container = {\n // background: '#efefef',\n // border: '1px solid #ccc'\n};\n\nexport let DataList = ({ items }: { items: { label: string; value: string }[] }) => {\n return (\n <Section style={container}>\n {items.map(({ label, value }, i) => (\n <Row key={i}>\n <Column style={{ padding: '10px 0px' }}>\n <Text style={{ fontSize: 14, fontWeight: 'bold', padding: '3px 0px', margin: 0 }}>\n {label}:{' '}\n </Text>\n <Text style={{ fontSize: 14, padding: '3px 0px', margin: 0 }}>{value}</Text>\n </Column>\n </Row>\n ))}\n </Section>\n );\n};\n","import {\n Body,\n Container,\n Head,\n Hr,\n Html,\n Img,\n Preview,\n Section,\n Text\n} from '@react-email/components';\nimport React from 'react';\n\nlet main = {\n backgroundColor: '#ffffff',\n margin: '0 auto',\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif\"\n};\n\nlet container = {\n maxWidth: '600px',\n margin: '0 auto'\n};\n\nlet logoContainer = {\n marginTop: '25px'\n};\n\nlet footerText = {\n fontSize: '12px',\n color: '#777'\n};\n\nlet hr = {\n margin: '20px 0px',\n border: 'none',\n borderBottom: '1px solid #ddd',\n background: 'none'\n};\n\nexport let Wrapper = ({\n children,\n preview\n}: {\n children?: React.ReactNode;\n preview?: string;\n}) => {\n return (\n <Html>\n <Head />\n\n {preview && <Preview>{preview}</Preview>}\n\n <Body style={main}>\n <Container style={container}>\n <Section style={logoContainer}>\n <Img\n src=\"https://cdn.metorial.com/2025-06-13--14-59-55/logos/metorial/primary_logo_text/resized-100-w881-h256.png\"\n height=\"30\"\n alt=\"Metorial\"\n />\n </Section>\n\n {children}\n\n <Hr style={hr} />\n\n <Section>\n {process.env.METORIAL_SOURCE == 'enterprise' ? (\n <Text style={footerText}>\n Sent by Metorial 💌. If you have any questions, feel free to contact us. If you\n need to reference this message use this ID: EMAIL_ID.\n </Text>\n ) : (\n <Text style={footerText}>\n Sent by a self hosted instance of <a href=\"https://metorial.com\">Metorial</a>.\n Contact the administrator of this instance if you have any questions.\n </Text>\n )}\n </Section>\n </Container>\n </Body>\n </Html>\n );\n};\n","import { Section, Text } from '@react-email/components';\n\nexport let Code = ({ code }: { code: string }) => {\n let first3 = code.slice(0, 3);\n let last3 = code.slice(3, 6);\n\n return (\n <Section\n style={{\n background: '#fff',\n border: '1px solid #ddd',\n borderRadius: '8px',\n margin: '20px 0px',\n padding: '6px 15px'\n }}\n >\n <Text\n style={{\n fontSize: '20px',\n textAlign: 'center',\n verticalAlign: 'middle'\n }}\n >\n <span>{first3}</span>\n <span style={{ margin: '0 5px', color: '#aaa' }}>-</span>\n <span>{last3}</span>\n </Text>\n </Section>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Layout = ({\n title,\n description,\n children,\n style\n}: {\n title: React.ReactNode;\n description?: React.ReactNode;\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <React.Fragment>\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 20,\n fontWeight: 'bold',\n marginBottom: 10,\n ...style\n }}\n >\n {title}\n </EmailText>\n\n {description && (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 16,\n marginBottom: 20,\n ...style\n }}\n >\n {description}\n </EmailText>\n )}\n\n {children}\n </React.Fragment>\n );\n};\n","import { Text as EmailText } from '@react-email/components';\nimport React from 'react';\n\nexport let Text = ({\n children,\n style\n}: {\n children: React.ReactNode;\n style?: React.CSSProperties;\n}) => {\n return (\n <EmailText\n style={{\n fontFamily: 'sans-serif',\n fontSize: 14,\n ...style\n }}\n >\n {children}\n </EmailText>\n );\n};\n","import { render } from '@react-email/components';\nimport React from 'react';\nimport { Wrapper } from '../components/wrapper';\n\nexport interface IEmail {\n subject: string;\n html: string | Promise<string>;\n text: string | Promise<string>;\n}\n\nexport let createEmail = ({\n content,\n preview,\n subject\n}: {\n content: React.ReactElement;\n preview?: string;\n subject: string;\n}) => {\n let inner = <Wrapper preview={preview}>{content}</Wrapper>;\n\n let html = render(inner, { plainText: false });\n let text = render(inner, { plainText: true });\n\n return {\n subject,\n html,\n text\n };\n};\n","import { createClient } from '@lowerdeck/rpc-client';\nimport type { RelayClient } from '../../../service/src/controllers';\n\nexport * from './templates';\n\ntype ClientOpts = Parameters<typeof createClient>[0];\n\nexport type EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;\n\nexport let createRelayClient = (o: ClientOpts) => {\n let inner = createClient<RelayClient>(o);\n\n return inner;\n};\n","import { IEmail } from './lib/email';\n\nexport interface ITemplate<Data> {\n render: (data: Data) => IEmail | Promise<IEmail>;\n}\n\nexport let createTemplate = <Data>(template: ITemplate<Data>) => template;\n"],"names":["buttonContainer","padding","textAlign","button","backgroundColor","borderRadius","fontWeight","color","fontSize","textDecoration","display","container","main","margin","fontFamily","maxWidth","logoContainer","marginTop","footerText","hr","border","borderBottom","background","Wrapper","_ref","children","preview","_jsxs","Html","_jsx","Head","Preview","jsx","Body","style","jsxs","Container","Section","Img","src","height","alt","Hr","process","env","METORIAL_SOURCE","Text","href","EmailButton","_extends","code","first3","slice","last3","verticalAlign","items","map","_ref2","i","value","Row","Column","label","title","description","React","Fragment","EmailText","marginBottom","subject","inner","content","html","render","plainText","text","o","createClient","template"],"mappings":"mxBAGA,IAAIA,EAAkB,CACpBC,QAAS,cACTC,UAAW,UAGTC,EAAS,CACXC,gBAAiB,UACjBC,aAAc,MACdC,WAAY,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AAMC,oBACLrC,EAAAA,IAACsC,EAAAA,KACC,CAAAjC,MAAKe,EAAA,CACHnC,WAAY,aACZN,SAAU,GACVF,WAAY,OACZ8D,aAAc,IACXlC,GAGJT,SAAAsC,IAGFC,GACCnC,EAAAA,IAACsC,EAAAA,KACC,CAAAjC,MAAKe,EACHnC,CAAAA,WAAY,aACZN,SAAU,GACV4D,aAAc,IACXlC,GACJT,SAEAuC,IAIJvC,IAGP,SCzCkB,SAAHD,GAMV,IALHC,EAAQD,EAARC,SAMA,OACEI,EAAAG,IAACmC,OAAS,CACRjC,MAAKe,EACHnC,CAAAA,WAAY,aACZN,SAAU,IATXgB,EAALU,OAaKT,SAAAA,GAGP,4BCXyB,SAAHD,GACpB,IAEA6C,EAAO7C,EAAP6C,QAMIC,EAAQzC,EAAAA,IAACN,EAAO,CAACG,QAPdF,EAAPE,QAOqCD,SAR9BD,EAAP+C,UAaA,MAAO,CACLF,QAAAA,EACAG,KALSC,SAAOH,EAAO,CAAEI,WAAW,IAMpCC,KALSF,EAAAA,OAAOH,EAAO,CAAEI,WAAW,IAOxC,sBCpB+B,SAACE,GAG9B,OAFYC,eAA0BD,EAGxC,mBCP4B,SAAOE,GAA8B,OAAAA,CAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metorial-services/relay-client",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/index.ts CHANGED
@@ -1,44 +1,14 @@
1
1
  import { createClient } from '@lowerdeck/rpc-client';
2
2
  import type { RelayClient } from '../../../service/src/controllers';
3
- import { ITemplate } from './templates';
4
3
 
5
4
  export * from './templates';
6
5
 
7
6
  type ClientOpts = Parameters<typeof createClient>[0];
8
7
 
9
- type EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;
8
+ export type EmailIdentity = Awaited<ReturnType<RelayClient['emailIdentity']['get']>>;
10
9
 
11
10
  export let createRelayClient = (o: ClientOpts) => {
12
11
  let inner = createClient<RelayClient>(o);
13
12
 
14
- return {
15
- client: inner,
16
-
17
- createTemplate<Data>(
18
- template: ITemplate<Data>,
19
- identity: EmailIdentity | Promise<EmailIdentity>,
20
- sender: { id: string } | Promise<{ id: string }>
21
- ) {
22
- return {
23
- send: async (i: { data: Data; to: string[] }) => {
24
- let rendered = await template.render(i.data);
25
-
26
- return await inner.email.send({
27
- type: 'email',
28
- to: i.to,
29
- template: i.data as any,
30
-
31
- emailIdentityId: (await identity).id,
32
- senderId: (await sender).id,
33
-
34
- content: {
35
- subject: rendered.subject,
36
- html: await rendered.html,
37
- text: await rendered.text
38
- }
39
- });
40
- }
41
- };
42
- }
43
- };
13
+ return inner;
44
14
  };