@maily-to/render 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +24 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +24 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -25,6 +25,19 @@ type MetaDescriptor = {
|
|
|
25
25
|
};
|
|
26
26
|
type MetaDescriptors = MetaDescriptor[];
|
|
27
27
|
//#endregion
|
|
28
|
+
//#region src/preheader.d.ts
|
|
29
|
+
declare class Preheader {
|
|
30
|
+
private readonly maily;
|
|
31
|
+
constructor(maily: Maily);
|
|
32
|
+
render(content: string | JSONContent$1): string;
|
|
33
|
+
private renderNode;
|
|
34
|
+
private doc;
|
|
35
|
+
private paragraph;
|
|
36
|
+
private text;
|
|
37
|
+
private variable;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=preheader.d.ts.map
|
|
40
|
+
//#endregion
|
|
28
41
|
//#region src/maily.d.ts
|
|
29
42
|
interface NodeOptions {
|
|
30
43
|
parent?: JSONContent$1;
|
|
@@ -44,7 +57,7 @@ interface MailyConfig {
|
|
|
44
57
|
*
|
|
45
58
|
* Default: `undefined`
|
|
46
59
|
*/
|
|
47
|
-
preview?: string;
|
|
60
|
+
preview?: string | JSONContent$1;
|
|
48
61
|
/**
|
|
49
62
|
* The theme object allows you to customize the colors and font sizes of the
|
|
50
63
|
* rendered email.
|
|
@@ -137,6 +150,7 @@ type LinkValues = Map<string, string>;
|
|
|
137
150
|
type PayloadValue = Record<string, any> | boolean;
|
|
138
151
|
type PayloadValues = Map<string, PayloadValue>;
|
|
139
152
|
declare class Maily {
|
|
153
|
+
readonly preheader: Preheader;
|
|
140
154
|
private readonly content;
|
|
141
155
|
private config;
|
|
142
156
|
private variableFormatter;
|
|
@@ -149,7 +163,7 @@ declare class Maily {
|
|
|
149
163
|
private meta;
|
|
150
164
|
private htmlProps;
|
|
151
165
|
constructor(content?: JSONContent$1);
|
|
152
|
-
setPreviewText(preview?: string): void;
|
|
166
|
+
setPreviewText(preview?: string | JSONContent$1): void;
|
|
153
167
|
setTheme(theme: Partial<RendererThemeOptions>): void;
|
|
154
168
|
setVariableFormatter(formatter: VariableFormatter): void;
|
|
155
169
|
/**
|
|
@@ -208,6 +222,13 @@ declare class Maily {
|
|
|
208
222
|
getAllLinks(): Set<string>;
|
|
209
223
|
private isValidUrl;
|
|
210
224
|
render(options?: RenderOptions): Promise<string>;
|
|
225
|
+
/**
|
|
226
|
+
* `children` will return the children of the content.
|
|
227
|
+
* this is useful for rendering the content in a custom component.
|
|
228
|
+
*
|
|
229
|
+
* @returns The children of the content as JSX elements
|
|
230
|
+
*/
|
|
231
|
+
children(): (react_jsx_runtime0.JSX.Element | null)[];
|
|
211
232
|
/**
|
|
212
233
|
* `markup` will render the JSON content into React Email markup.
|
|
213
234
|
* and return the raw React Tree.
|
|
@@ -229,7 +250,7 @@ declare class Maily {
|
|
|
229
250
|
private variableUrlValue;
|
|
230
251
|
private heading;
|
|
231
252
|
private variable;
|
|
232
|
-
|
|
253
|
+
getVariableValue(variable: string, fallback?: string, options?: NodeOptions): string;
|
|
233
254
|
private horizontalRule;
|
|
234
255
|
private orderedList;
|
|
235
256
|
private bulletList;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/meta.tsx","../src/maily.tsx","../src/render.ts"],"sourcesContent":[],"mappings":";;;;;;KAAY,cAAA;;;;;;EAAA,OAAA,EAAA,MAAA;AA2BZ,CAAA,GAAY;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/meta.tsx","../src/preheader.ts","../src/maily.tsx","../src/render.ts"],"sourcesContent":[],"m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;;;;;;;;;;;;sBAy0B5C,yBAAuB,cAAc,GAAA,CAAI;;;;;iBCzqDzC,MAAA,UACX,wBACA,cAAc,gBACtB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,19 @@ type MetaDescriptor = {
|
|
|
25
25
|
};
|
|
26
26
|
type MetaDescriptors = MetaDescriptor[];
|
|
27
27
|
//#endregion
|
|
28
|
+
//#region src/preheader.d.ts
|
|
29
|
+
declare class Preheader {
|
|
30
|
+
private readonly maily;
|
|
31
|
+
constructor(maily: Maily);
|
|
32
|
+
render(content: string | JSONContent$1): string;
|
|
33
|
+
private renderNode;
|
|
34
|
+
private doc;
|
|
35
|
+
private paragraph;
|
|
36
|
+
private text;
|
|
37
|
+
private variable;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=preheader.d.ts.map
|
|
40
|
+
//#endregion
|
|
28
41
|
//#region src/maily.d.ts
|
|
29
42
|
interface NodeOptions {
|
|
30
43
|
parent?: JSONContent$1;
|
|
@@ -44,7 +57,7 @@ interface MailyConfig {
|
|
|
44
57
|
*
|
|
45
58
|
* Default: `undefined`
|
|
46
59
|
*/
|
|
47
|
-
preview?: string;
|
|
60
|
+
preview?: string | JSONContent$1;
|
|
48
61
|
/**
|
|
49
62
|
* The theme object allows you to customize the colors and font sizes of the
|
|
50
63
|
* rendered email.
|
|
@@ -137,6 +150,7 @@ type LinkValues = Map<string, string>;
|
|
|
137
150
|
type PayloadValue = Record<string, any> | boolean;
|
|
138
151
|
type PayloadValues = Map<string, PayloadValue>;
|
|
139
152
|
declare class Maily {
|
|
153
|
+
readonly preheader: Preheader;
|
|
140
154
|
private readonly content;
|
|
141
155
|
private config;
|
|
142
156
|
private variableFormatter;
|
|
@@ -149,7 +163,7 @@ declare class Maily {
|
|
|
149
163
|
private meta;
|
|
150
164
|
private htmlProps;
|
|
151
165
|
constructor(content?: JSONContent$1);
|
|
152
|
-
setPreviewText(preview?: string): void;
|
|
166
|
+
setPreviewText(preview?: string | JSONContent$1): void;
|
|
153
167
|
setTheme(theme: Partial<RendererThemeOptions>): void;
|
|
154
168
|
setVariableFormatter(formatter: VariableFormatter): void;
|
|
155
169
|
/**
|
|
@@ -208,6 +222,13 @@ declare class Maily {
|
|
|
208
222
|
getAllLinks(): Set<string>;
|
|
209
223
|
private isValidUrl;
|
|
210
224
|
render(options?: RenderOptions): Promise<string>;
|
|
225
|
+
/**
|
|
226
|
+
* `children` will return the children of the content.
|
|
227
|
+
* this is useful for rendering the content in a custom component.
|
|
228
|
+
*
|
|
229
|
+
* @returns The children of the content as JSX elements
|
|
230
|
+
*/
|
|
231
|
+
children(): (react_jsx_runtime0.JSX.Element | null)[];
|
|
211
232
|
/**
|
|
212
233
|
* `markup` will render the JSON content into React Email markup.
|
|
213
234
|
* and return the raw React Tree.
|
|
@@ -229,7 +250,7 @@ declare class Maily {
|
|
|
229
250
|
private variableUrlValue;
|
|
230
251
|
private heading;
|
|
231
252
|
private variable;
|
|
232
|
-
|
|
253
|
+
getVariableValue(variable: string, fallback?: string, options?: NodeOptions): string;
|
|
233
254
|
private horizontalRule;
|
|
234
255
|
private orderedList;
|
|
235
256
|
private bulletList;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/meta.tsx","../src/maily.tsx","../src/render.ts"],"sourcesContent":[],"mappings":";;;;;;KAAY,cAAA;;;;;;EAAA,OAAA,EAAA,MAAA;AA2BZ,CAAA,GAAY;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/meta.tsx","../src/preheader.ts","../src/maily.tsx","../src/render.ts"],"sourcesContent":[],"mappings":";;;;;;KAAY,cAAA;;;;;;EAAA,OAAA,EAAA,MAAA;AA2BZ,CAAA,GAAY;;;;ECxBC,SAAA,EAAA,MAAS;EAAA,OAAA,EAAA,MAAA;CAAA,GAAA;EACqB,OAEhB,EAAA,MAAA,GAAA,MAAA;EAAW,CAAA,SAAA,E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Descriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=s(require(`react`)),l=s(require(`@react-email/components`)),u=s(require(`@react-email/render`)),d=s(require(`react/jsx-runtime`)),f=s(require(`node-html-parser`)),p=s(require(`juice`)),m=e=>Object.prototype.toString.call(e),h=e=>m(e)===`[object Object]`;function g(e){return Object.keys(e)}function _(e,...t){if(!t.length)return e;let n=t.shift();return n===void 0?e:(v(e)&&v(n)&&g(n).forEach(t=>{t===`__proto__`||t===`constructor`||t===`prototype`||(v(n[t])?(e[t]||(e[t]={}),v(e[t])?_(e[t],n[t]):e[t]=n[t]):e[t]=n[t])}),_(e,...t))}function v(e){return h(e)&&!Array.isArray(e)}const y=Symbol(`p-void`);function b(){return Math.random().toString(36).substr(2,6)}function x(e){return e.filter((e,t,n)=>{let r=C(e);return t===n.findIndex(e=>C(e)===r)}).map(S).filter(Boolean)}function S(e){if(`tagName`in e){let{tagName:t,...n}=e,r=t;return(0,d.jsx)(r,{...n},JSON.stringify(n))}return`title`in e?(0,d.jsx)(`title`,{children:e.title}):`charSet`in e?(0,d.jsx)(`meta`,{charSet:e.charSet}):(0,d.jsx)(`meta`,{...e},JSON.stringify(e))}function C(e){let t=Object.keys(e).sort().reduce((t,n)=>{let r=n;return t[r]=e[r],t},{});return JSON.stringify(t)}const w={fallbackFontFamily:`sans-serif`,fontFamily:`Inter`,webFont:{url:`https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19`,format:`woff2`}},T=`#111827`,E={colors:{heading:`#111827`,paragraph:`#374151`,horizontal:`#EAEAEA`,footer:`#64748B`,blockquoteBorder:`#D1D5DB`,codeBackground:`#EFEFEF`,codeText:`#111827`,linkCardTitle:`#111827`,linkCardDescription:`#6B7280`,linkCardBadgeText:`#111827`,linkCardBadgeBackground:`#FEF08A`,linkCardSubTitle:`#6B7280`},fontSize:{paragraph:{size:`15px`,lineHeight:`26.25px`},footer:{size:`14px`,lineHeight:`24px`}},container:{backgroundColor:`#ffffff`,maxWidth:`600px`,minWidth:`300px`,paddingTop:`0.5rem`,paddingRight:`0.5rem`,paddingBottom:`0.5rem`,paddingLeft:`0.5rem`,borderRadius:`0px`,borderWidth:`0px`,borderColor:`transparent`},body:{backgroundColor:`#ffffff`,paddingTop:`0px`,paddingRight:`0px`,paddingBottom:`0px`,paddingLeft:`0px`},button:{backgroundColor:`#000000`,color:`#ffffff`,paddingTop:`10px`,paddingRight:`32px`,paddingBottom:`10px`,paddingLeft:`32px`},link:{color:T},font:w},D={WebkitFontSmoothing:`antialiased`,MozOsxFontSmoothing:`grayscale`},O={h1:{fontSize:`36px`,lineHeight:`40px`,fontWeight:800},h2:{fontSize:`30px`,lineHeight:`36px`,fontWeight:700},h3:{fontSize:`24px`,lineHeight:`38px`,fontWeight:600}},k={sm:`40px`,md:`48px`,lg:`64px`},A=`SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,j=`#ffffff`,M=`left`,N=1,P=`#000000`,F=0,I=0,L=0,R=0,z=5,B=5,V=5,H=5,U=`100%`,W=8,G=`transparent`,K=0,q=0,ee=`transparent`,te=0,ne=0,re=0,ie=0,J=20,Y=20,X=/https?:\/\//,Z=[{name:`viewport`,content:`width=device-width`},{httpEquiv:`X-UA-Compatible`,content:`IE=edge`},{name:`x-apple-disable-message-reformatting`},{name:`format-detection`,content:`telephone=no,address=no,email=no,date=no,url=no`},{name:`color-scheme`,content:`light`},{name:`supported-color-schemes`,content:`light`}],Q={lang:`en`,dir:`ltr`},ae={pretty:!1,plainText:!1};var $=class{content;config={theme:E};variableFormatter=({variable:e,fallback:t})=>t?`{{${e},fallback=${t}}}`:`{{${e}}}`;shouldReplaceVariableValues=!1;variableValues=new Map;linkValues=new Map;openTrackingPixel;payloadValues=new Map;marksOrder=[`underline`,`bold`,`italic`,`textStyle`,`link`];meta=Z;htmlProps=Q;constructor(e={type:`doc`,content:[]}){this.content=e}setPreviewText(e){this.config.preview=e}setTheme(e){this.config.theme=_(this.config.theme||E,e)}setVariableFormatter(e){this.variableFormatter=e}setVariableValue(e,t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(e,t)}setVariableValues(e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(e).forEach(([e,t])=>{this.setVariableValue(e,t)})}setLinkValue(e,t){this.linkValues.set(e,t)}setLinkValues(e){Object.entries(e).forEach(([e,t])=>{this.setLinkValue(e,t)})}setPayloadValue(e,t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(e,t)}setPayloadValues(e){Object.entries(e).forEach(([e,t])=>{this.setPayloadValue(e,t)})}setOpenTrackingPixel(e){this.openTrackingPixel=e}setShouldReplaceVariableValues(e){this.shouldReplaceVariableValues=e}setMetaTags(e){this.meta.push(...e)}setHtmlProps(e){this.htmlProps={...this.htmlProps,...e}}getAllLinks(){let e=this.content.content||[],t=new Set,n=e=>e&&this.isValidUrl(e)&&!e.startsWith(`#`)&&!e.startsWith(`mailto:`)&&!e.startsWith(`tel:`)&&typeof e==`string`,r=e=>{if(e.type===`button`){let r=e.attrs?.url;n(r)&&r&&t.add(r)}else e.content&&e.content.forEach(e=>{e.marks&&e.marks.forEach(e=>{let r=e.attrs?.href;e.type===`link`&&n(r)&&t.add(r)}),e.content&&r(e)})};return e.forEach(e=>{r(e)}),t}isValidUrl(e){try{let t=new URL(e);return!0}catch(e){return!1}}async render(e=ae){let t=this.markup();return(0,u.renderAsync)(t,e)}markup(){let e=this.content.content||[],t=e.map((t,n)=>{let r={prev:e[n-1],next:e[n+1],parent:t},i=this.renderNode(t,r);return i?(0,d.jsx)(c.Fragment,{children:i},b()):null}),{preview:n}=this.config,r=x(this.meta),i=this.htmlProps,a=this.config.theme?.container,o={...this.config.theme?.font||w,fontStyle:`normal`,fontWeight:400},s={margin:`0px`,...this.config.theme?.body},u=(0,d.jsxs)(l.Html,{...i,children:[(0,d.jsxs)(l.Head,{children:[(0,d.jsx)(l.Font,{...o}),(0,d.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}`}}),r]}),(0,d.jsxs)(l.Body,{style:s,children:[n?(0,d.jsx)(l.Preview,{id:`__react-email-preview`,children:n}):null,(0,d.jsx)(l.Container,{style:{width:`100%`,marginLeft:`auto`,marginRight:`auto`,borderStyle:`solid`,...a},children:t}),this.openTrackingPixel?(0,d.jsx)(l.Img,{alt:``,src:this.openTrackingPixel,style:{display:`none`,width:`1px`,height:`1px`}}):null]})]});return u}getMarginOverrideConditions(e,t){let{parent:n,prev:r,next:i}=t||{},a=i?.type===`spacer`,o=r?.type===`spacer`,s=n?.type===`listItem`,c=n?.type===`section`&&!i,l=n?.type===`section`&&!r,u=n?.type===`column`&&!i,d=n?.type===`column`&&!r,f=n?.type===`repeat`&&!r,p=n?.type===`repeat`&&!i,m=n?.type===`show`&&!r,h=n?.type===`show`&&!i;return{isNextSpacer:a,isPrevSpacer:o,isLastSectionElement:c,isFirstSectionElement:l,isParentListItem:s,isLastColumnElement:u,isFirstColumnElement:d,isFirstRepeatElement:f,isLastRepeatElement:p,isFirstShowElement:m,isLastShowElement:h,shouldRemoveTopMargin:o||l||d||f||m,shouldRemoveBottomMargin:a||c||u||p||h}}getMappedContent(e,t){let n=e.content||[];return n.map((e,r)=>{let i=this.renderNode(e,{...t,next:n[r+1],prev:n[r-1]});return i?(0,d.jsx)(c.Fragment,{children:i},b()):null}).filter(e=>e!==null)}renderNode(e,t={}){let n=e.type||``;if(n in this)return this[n]?.(e,t);throw Error(`Node type "${n}" is not supported.`)}renderMark(e,t){let n=e?.text||(0,d.jsx)(d.Fragment,{children:`\xA0`}),r=e?.marks||[];return r.sort((e,t)=>this.marksOrder.indexOf(e.type)-this.marksOrder.indexOf(t.type)),r.reduce((e,t)=>{let n=t.type;if(n in this)return this[n]?.(t,e);throw Error(`Mark type "${n}" is not supported.`)},(0,d.jsx)(d.Fragment,{children:n}))}paragraph(e,t){let{attrs:n}=e,r=n?.textAlign||`left`,{isParentListItem:i,shouldRemoveBottomMargin:a}=this.getMarginOverrideConditions(e,t),o=this.shouldShow(e,t);if(!o)return(0,d.jsx)(d.Fragment,{});let s=i||a?0:20;return(0,d.jsx)(l.Text,{style:{...r===`left`?{}:{textAlign:r},...D,fontSize:this.config.theme?.fontSize?.paragraph?.size,lineHeight:this.config.theme?.fontSize?.paragraph?.lineHeight,color:this.config.theme?.colors?.paragraph,margin:`0 0 ${s}px 0`},children:e.content?this.getMappedContent(e,{...t,parent:e}):(0,d.jsx)(d.Fragment,{children:`\xA0`})})}text(e,t){if(e.marks)return this.renderMark(e,t);let n=e.text,r=n?.match(/\s/g);return r&&r.length===n?.length?(0,d.jsx)(d.Fragment,{children:r.map((e,t)=>(0,d.jsx)(c.Fragment,{children:`\xA0`},t))}):n?(0,d.jsx)(d.Fragment,{children:n}):(0,d.jsx)(d.Fragment,{children:`\xA0`})}bold(e,t){return(0,d.jsx)(`strong`,{children:t})}italic(e,t){return(0,d.jsx)(`em`,{children:t})}underline(e,t){return(0,d.jsx)(`u`,{children:t})}strike(e,t){return(0,d.jsx)(`s`,{style:{textDecoration:`line-through`},children:t})}textStyle(e,t){let{attrs:n}=e,{color:r=this.config.theme?.colors?.paragraph}=n||{};return(0,d.jsx)(`span`,{style:{color:r},children:t})}link(e,t,n){let{attrs:r}=e,i=this.config.theme?.link,a=r?.href||`#`,o=r?.target||`_blank`,s=r?.rel||`noopener noreferrer nofollow`,c=r?.isUrlVariable??!1;if(c){let e=this.removeLinkProtocol(a);a=this.variableUrlValue(e,n)}else a=this.linkValues.get(a)||a;return(0,d.jsx)(l.Link,{href:a,rel:s,style:{fontWeight:500,textDecoration:`none`,color:i?.color||T},target:o,children:t})}removeLinkProtocol(e){return e.replace(X,``)}variableUrlValue(e,t){let{payloadValue:n}=t||{},r=this.removeLinkProtocol(e);return this.shouldReplaceVariableValues?(typeof n==`object`?n[r]:n)??this.variableValues.get(r)??e:this.variableFormatter({variable:r})}heading(e,t){let{attrs:n}=e,r=`h${Number(n?.level)||1}`,i=n?.textAlign||`left`,{shouldRemoveBottomMargin:a}=this.getMarginOverrideConditions(e,t),{fontSize:o,lineHeight:s,fontWeight:c}=O[r],u=this.shouldShow(e,t);return u?(0,d.jsx)(l.Heading,{as:r,style:{textAlign:i,color:this.config.theme?.colors?.heading,fontSize:o,lineHeight:s,fontWeight:c},mb:a?0:12,mt:0,mx:0,children:this.getMappedContent(e,{...t,parent:e})}):(0,d.jsx)(d.Fragment,{})}variable(e,t){let{payloadValue:n}=t||{},{id:r,fallback:i}=e.attrs||{},a=this.shouldShow(e,t);if(!a||!r)return(0,d.jsx)(d.Fragment,{});let o=this.getVariableValue(r,i,t);return e?.marks?this.renderMark({text:o,marks:e.marks},t):(0,d.jsx)(d.Fragment,{children:o})}getVariableValue(e,t,n){let{payloadValue:r}=n||{},i=this.variableFormatter({variable:e,fallback:t});return this.shouldReplaceVariableValues&&(i=(typeof r==`object`?r[e]:r)??this.variableValues.get(e)??t??i),i}horizontalRule(e,t){return(0,d.jsx)(l.Hr,{style:{marginTop:`32px`,marginBottom:`32px`}})}orderedList(e,t){let{shouldRemoveBottomMargin:n}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(l.Container,{style:{marginTop:`0px`,marginBottom:n?`0`:`20px`},children:(0,d.jsx)(`ol`,{style:{paddingLeft:`26px`,listStyleType:`decimal`},children:this.getMappedContent(e,{...t,parent:e})})})}bulletList(e,t){let{parent:n,next:r}=t||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(e,{parent:n,next:r});return(0,d.jsx)(l.Container,{style:{maxWidth:`100%`,marginTop:`0px`,marginBottom:i?`0`:`20px`},children:(0,d.jsx)(`ul`,{style:{paddingLeft:`26px`,listStyleType:`disc`},children:this.getMappedContent(e,{...t,parent:e})})})}listItem(e,t){return(0,d.jsx)(`li`,{style:{marginBottom:`8px`,marginTop:`8px`,paddingLeft:`6px`,...D},children:this.getMappedContent(e,{...t,parent:e})})}button(e,t){let{attrs:n}=e,r=this.config.theme?.button,{text:i,isTextVariable:a,url:o,isUrlVariable:s,variant:c,buttonColor:u,textColor:f,borderRadius:p,alignment:m=`left`,paddingTop:h,paddingRight:g,paddingBottom:_,paddingLeft:v}=n||{},y=u||r?.backgroundColor,b=f||r?.color,x=parseInt(String(h||r?.paddingTop))||0,S=parseInt(String(g||r?.paddingRight))||0,C=parseInt(String(_||r?.paddingBottom))||0,w=parseInt(String(v||r?.paddingLeft))||0,T=this.shouldShow(e,t);if(!T)return(0,d.jsx)(d.Fragment,{});let E=`0px`;p===`round`?E=`9999px`:p===`smooth`&&(E=`6px`);let{shouldRemoveBottomMargin:D}=this.getMarginOverrideConditions(e,t),O=s?this.variableUrlValue(o,t):this.linkValues.get(o)||o,k=a?this.variableUrlValue(i,t):i;return x+=2,C+=2,(0,d.jsx)(l.Container,{style:{textAlign:m,maxWidth:`100%`,marginBottom:D?`0px`:`20px`},children:(0,d.jsx)(l.Button,{href:O,style:{color:String(b),backgroundColor:c===`filled`?String(y):`transparent`,borderColor:String(y),borderWidth:`2px`,borderStyle:`solid`,textDecoration:`none`,fontSize:`14px`,fontWeight:500,borderRadius:E,padding:`${x}px ${S}px ${C}px ${w}px`},children:k})})}spacer(e,t){let{attrs:n}=e,{height:r}=n||{},i=this.shouldShow(e,t);return i?(0,d.jsx)(l.Container,{style:{height:`${r}px`}}):(0,d.jsx)(d.Fragment,{})}hardBreak(e,t){return(0,d.jsx)(`br`,{})}logo(e,t){let{attrs:n}=e,{src:r,isSrcVariable:i,alt:a,title:o,size:s,alignment:c=`left`}=n||{},u=this.shouldShow(e,t);if(!u)return(0,d.jsx)(d.Fragment,{});r=i?this.variableUrlValue(r,t):r;let{shouldRemoveBottomMargin:f}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(l.Row,{style:{marginTop:`0px`,marginBottom:f?`0px`:`32px`},children:(0,d.jsx)(l.Column,{align:c,children:(0,d.jsx)(l.Img,{alt:a||o||`Logo`,src:r,style:{width:k[s]||s,height:k[s]||s},title:o||a||`Logo`})})})}image(e,t){let{attrs:n}=e,{src:r,isSrcVariable:i,alt:a,title:o,width:s=`auto`,height:c=`auto`,alignment:u=`center`,externalLink:f=``,isExternalLinkVariable:p,borderRadius:m=0}=n||{},h=this.shouldShow(e,t);if(!h)return(0,d.jsx)(d.Fragment,{});let{shouldRemoveBottomMargin:g}=this.getMarginOverrideConditions(e,t);r=i?this.variableUrlValue(r,t):r,f=p?this.variableUrlValue(f,t):f;let _=s===`auto`?`auto`:Number(s),v=_===`auto`?`auto`:`${_}px`,y=c===`auto`?`auto`:Number(c),b=y===`auto`?`auto`:`${y}px`,x=(0,d.jsx)(l.Img,{alt:a||o||`Image`,src:r,style:{width:v,height:b,maxWidth:`100%`,outline:`none`,border:`none`,textDecoration:`none`,display:`block`,borderRadius:m},title:o||a||`Image`});return(0,d.jsx)(l.Row,{style:{marginTop:`0px`,marginBottom:g?`0px`:`32px`},children:(0,d.jsx)(l.Column,{align:u,children:f?(0,d.jsx)(`a`,{href:f,rel:`noopener noreferrer`,style:{display:`block`,maxWidth:`100%`,textDecoration:`none`},target:`_blank`,children:x}):x})})}footer(e,t){let{attrs:n}=e,{textAlign:r=`left`}=n||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(l.Text,{style:{fontSize:this.config.theme?.fontSize?.footer?.size,lineHeight:this.config.theme?.fontSize?.footer?.lineHeight,color:this.config.theme?.colors?.footer,marginTop:`0px`,marginBottom:i?`0px`:`20px`,textAlign:r,...D},children:this.getMappedContent(e,{...t,parent:e})})}blockquote(e,t){let{isPrevSpacer:n,shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(`blockquote`,{style:{borderLeftWidth:`4px`,borderLeftStyle:`solid`,borderLeftColor:this.config.theme?.colors?.blockquoteBorder,paddingLeft:`16px`,marginLeft:`0px`,marginRight:`0px`,marginTop:n?`0px`:`20px`,marginBottom:r?`0px`:`20px`},children:this.getMappedContent(e,{...t,parent:e})})}code(e,t){return(0,d.jsx)(`code`,{style:{backgroundColor:this.config.theme?.colors?.codeBackground,color:this.config.theme?.colors?.codeText,padding:`2px 4px`,borderRadius:`6px`,fontFamily:A,fontWeight:400,letterSpacing:0},children:t})}linkCard(e,t){let{attrs:n}=e,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(e,t),{title:i,description:a,link:o,linkTitle:s,image:c,badgeText:u,subTitle:f}=n||{},p=this.linkValues.get(o)||this.variableValues.get(o)||o||`#`;return(0,d.jsxs)(`a`,{href:p,rel:`noopener noreferrer`,style:{border:`1px solid #eaeaea`,borderRadius:`10px`,textDecoration:`none`,color:`inherit`,display:`block`,marginBottom:r?`0px`:`20px`},target:`_blank`,children:[c?(0,d.jsx)(l.Row,{style:{marginBottom:`6px`},children:(0,d.jsx)(l.Column,{style:{width:`100%`,height:`100%`},children:(0,d.jsx)(l.Img,{alt:i||`Link Card`,src:c,style:{borderRadius:`10px 10px 0 0`,width:`100%`,height:`100%`,objectFit:`cover`},title:i||`Link Card`})})}):null,(0,d.jsx)(l.Row,{style:{padding:`15px`,marginTop:0,marginBottom:0},children:(0,d.jsxs)(l.Column,{style:{verticalAlign:`top`},children:[(0,d.jsxs)(l.Row,{align:void 0,style:{marginBottom:`8px`,marginTop:`0px`},width:`auto`,children:[(0,d.jsx)(l.Column,{children:(0,d.jsx)(l.Text,{style:{fontSize:`18px`,fontWeight:600,color:this.config.theme?.colors?.linkCardTitle,margin:`0px`,...D},children:i})}),u||f?(0,d.jsxs)(l.Column,{style:{paddingLeft:`6px`,verticalAlign:`middle`},children:[u?(0,d.jsx)(`span`,{style:{fontWeight:600,color:this.config.theme?.colors?.linkCardBadgeText,padding:`4px 8px`,borderRadius:`8px`,backgroundColor:this.config.theme?.colors?.linkCardBadgeBackground,fontSize:`12px`,lineHeight:`12px`},children:u}):null,` `,f&&!u?(0,d.jsx)(`span`,{style:{fontWeight:`normal`,color:this.config.theme?.colors?.linkCardSubTitle,fontSize:`12px`,lineHeight:`12px`},children:f}):null]}):null]}),(0,d.jsxs)(l.Text,{style:{fontSize:`16px`,color:this.config.theme?.colors?.linkCardDescription,marginTop:`0px`,marginBottom:`0px`,...D},children:[a,` `,s?(0,d.jsx)(`a`,{href:p,rel:`noopener noreferrer`,style:{color:this.config.theme?.colors?.linkCardTitle,fontSize:`14px`,fontWeight:600,textDecoration:`underline`},children:s}):null]})]})})]})}section(e,t){let{attrs:n}=e,{borderRadius:r=0,backgroundColor:i=j,align:a=M,borderWidth:o=N,borderColor:s=P,marginTop:c=F,marginRight:u=I,marginBottom:f=L,marginLeft:p=R,paddingTop:m=z,paddingRight:h=B,paddingBottom:g=V,paddingLeft:_=H}=n||{},v=this.shouldShow(e,t);return v?(0,d.jsx)(l.Row,{style:{marginTop:c,marginRight:u,marginBottom:f,marginLeft:p},children:(0,d.jsx)(l.Column,{align:a,style:{borderColor:s,borderWidth:o,borderStyle:`solid`,backgroundColor:i,borderRadius:r,paddingTop:m,paddingRight:h,paddingBottom:g,paddingLeft:_},children:this.getMappedContent(e,{...t,parent:e})})}):(0,d.jsx)(d.Fragment,{})}columns(e,t){let{attrs:n}=e,r=this.shouldShow(e,t);if(!r)return(0,d.jsx)(d.Fragment,{});let[i,a]=this.adjustColumnsContent(e);return(0,d.jsx)(l.Row,{width:`${a}%`,style:{margin:0,padding:0,width:`${a}%`},className:`tab-row-full`,children:this.getMappedContent(i,{...t,parent:i})})}adjustColumnsContent(e){let{content:t=[]}=e,n=100,r=t.filter(e=>e.type===`column`&&!!Number(e.attrs?.width||0)),i=t.filter(e=>e.type===`column`&&(e.attrs?.width===`auto`||!e.attrs?.width)),a=r.reduce((e,t)=>e+Number(t.attrs?.width),0),o=n-a,s=Math.round(o/i.length),c=t.filter(e=>e.type===`column`).length,l=e.attrs?.gap??W;return[{...e,content:t.map((e,n)=>{let r=e.type===`column`&&(e.attrs?.width===`auto`||!e.attrs?.width),i=n===0,a=n>0&&n<c-1,o=n===t.length-1,u=0,d=0;if(c<3)u=i?0:l/2,d=o?0:l/2;else{let e=l/2*1.5,t=e/2;u=i?0:a?t:e,d=o?0:a?t:e}return u=Math.round(u*100)/100,d=Math.round(d*100)/100,{...e,attrs:{...e.attrs,width:r?s:e.attrs?.width,isFirstColumn:i,isLastColumn:o,index:n,paddingLeft:u,paddingRight:d}}})},i.length===0?Math.min(n,a):n]}column(e,t){let{attrs:n}=e,{width:r,verticalAlign:i=`top`,paddingLeft:a=0,paddingRight:o=0}=n||{};return(0,d.jsx)(l.Column,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:i},className:`tab-col-full`,children:(0,d.jsx)(l.Section,{style:{margin:0,paddingLeft:a,paddingRight:o},className:`tab-pad`,children:this.getMappedContent(e,{...t,parent:e})})})}repeat(e,t){let{attrs:n}=e,{each:r=``}=n||{},i=this.shouldShow(e,t);if(!i)return(0,d.jsx)(d.Fragment,{});let{payloadValue:a}=t||{};a=typeof a==`object`?a:{};let o=this.payloadValues.get(r)??a[r]??[];if(!Array.isArray(o))throw Error(`Payload value for each "${r}" is not an array`);return(0,d.jsx)(d.Fragment,{children:o.map(n=>(0,d.jsx)(c.Fragment,{children:this.getMappedContent(e,{...t,parent:e,payloadValue:n})},b()))})}for(e,t){return this.repeat(e,t)}shouldShow(e,t){let n=e?.attrs?.showIfKey??``;if(!n)return!0;let{payloadValue:r}=t||{};return r=typeof r==`object`?r:{},!!(this.payloadValues.get(n)??r[n])}htmlCodeBlock(e,t){let n=this.shouldShow(e,t);if(!n)return(0,d.jsx)(d.Fragment,{});let r=e.content?.reduce((e,n)=>{if(n?.type===`text`)return e+n?.text;if(n?.type===`variable`){let r=this.getVariableValue(n?.attrs?.id,n?.attrs?.fallback,t);return e+r}return e},``)||``,i=(0,p.default)(r),a=(0,f.parse)(i),o=a?.querySelector(`head`);o?.remove();let s=a.toString();return(0,d.jsx)(`table`,{align:`left`,width:`100%`,border:0,cellPadding:`0`,cellSpacing:`0`,role:`presentation`,children:(0,d.jsx)(`tbody`,{children:(0,d.jsx)(`tr`,{style:{width:`100%`},children:(0,d.jsx)(`td`,{style:{width:`100%`},dangerouslySetInnerHTML:{__html:s}})})})})}inlineImage(e,t){let{attrs:n}=e,{src:r,isSrcVariable:i,alt:a=``,title:o=``,height:s=J,width:c=Y,externalLink:l=``,isExternalLinkVariable:u}=n||{};r=i?this.variableUrlValue(r,t):r,l=u?this.variableUrlValue(l,t):l;let f=(0,d.jsx)(`img`,{src:r,alt:a,title:o,width:c,height:s,style:{display:`inline`,verticalAlign:`middle`,width:`${c}px`,height:`${s}px`,outline:`none`,border:`none`,textDecoration:`none`}});return l?(0,d.jsx)(`a`,{href:l,rel:`noopener noreferrer`,style:{display:`inline`,textDecoration:`none`},target:`_blank`,children:f}):f}};async function oe(e,t){let{theme:n,preview:r,...i}=t||{},a=new $(e);return a.setPreviewText(r),a.setTheme(n||{}),a.render(i)}exports.DEFAULT_COLUMNS_GAP=W,exports.DEFAULT_COLUMNS_WIDTH=U,exports.DEFAULT_COLUMN_BACKGROUND_COLOR=G,exports.DEFAULT_COLUMN_BORDER_COLOR=ee,exports.DEFAULT_COLUMN_BORDER_RADIUS=K,exports.DEFAULT_COLUMN_BORDER_WIDTH=q,exports.DEFAULT_COLUMN_PADDING_BOTTOM=re,exports.DEFAULT_COLUMN_PADDING_LEFT=ie,exports.DEFAULT_COLUMN_PADDING_RIGHT=ne,exports.DEFAULT_COLUMN_PADDING_TOP=te,exports.DEFAULT_HTML_PROPS=Q,exports.DEFAULT_INLINE_IMAGE_HEIGHT=J,exports.DEFAULT_INLINE_IMAGE_WIDTH=Y,exports.DEFAULT_META_TAGS=Z,exports.DEFAULT_SECTION_ALIGN=M,exports.DEFAULT_SECTION_BACKGROUND_COLOR=j,exports.DEFAULT_SECTION_BORDER_COLOR=P,exports.DEFAULT_SECTION_BORDER_WIDTH=N,exports.DEFAULT_SECTION_MARGIN_BOTTOM=L,exports.DEFAULT_SECTION_MARGIN_LEFT=R,exports.DEFAULT_SECTION_MARGIN_RIGHT=I,exports.DEFAULT_SECTION_MARGIN_TOP=F,exports.DEFAULT_SECTION_PADDING_BOTTOM=V,exports.DEFAULT_SECTION_PADDING_LEFT=H,exports.DEFAULT_SECTION_PADDING_RIGHT=B,exports.DEFAULT_SECTION_PADDING_TOP=z,exports.LINK_PROTOCOL_REGEX=X,exports.Maily=$,exports.render=oe;
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=s(require(`react`)),l=s(require(`@react-email/components`)),u=s(require(`@react-email/render`)),d=s(require(`react/jsx-runtime`)),f=s(require(`node-html-parser`)),p=s(require(`juice`)),m=e=>Object.prototype.toString.call(e),h=e=>m(e)===`[object Object]`;function g(e){return Object.keys(e)}function _(e,...t){if(!t.length)return e;let n=t.shift();return n===void 0?e:(v(e)&&v(n)&&g(n).forEach(t=>{t===`__proto__`||t===`constructor`||t===`prototype`||(v(n[t])?(e[t]||(e[t]={}),v(e[t])?_(e[t],n[t]):e[t]=n[t]):e[t]=n[t])}),_(e,...t))}function v(e){return h(e)&&!Array.isArray(e)}const y=Symbol(`p-void`);function b(){return Math.random().toString(36).substr(2,6)}function x(e){return e.filter((e,t,n)=>{let r=C(e);return t===n.findIndex(e=>C(e)===r)}).map(S).filter(Boolean)}function S(e){if(`tagName`in e){let{tagName:t,...n}=e,r=t;return(0,d.jsx)(r,{...n},JSON.stringify(n))}return`title`in e?(0,d.jsx)(`title`,{children:e.title}):`charSet`in e?(0,d.jsx)(`meta`,{charSet:e.charSet}):(0,d.jsx)(`meta`,{...e},JSON.stringify(e))}function C(e){let t=Object.keys(e).sort().reduce((t,n)=>{let r=n;return t[r]=e[r],t},{});return JSON.stringify(t)}const w={fallbackFontFamily:`sans-serif`,fontFamily:`Inter`,webFont:{url:`https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19`,format:`woff2`}},T=`#111827`,E={colors:{heading:`#111827`,paragraph:`#374151`,horizontal:`#EAEAEA`,footer:`#64748B`,blockquoteBorder:`#D1D5DB`,codeBackground:`#EFEFEF`,codeText:`#111827`,linkCardTitle:`#111827`,linkCardDescription:`#6B7280`,linkCardBadgeText:`#111827`,linkCardBadgeBackground:`#FEF08A`,linkCardSubTitle:`#6B7280`},fontSize:{paragraph:{size:`15px`,lineHeight:`26.25px`},footer:{size:`14px`,lineHeight:`24px`}},container:{backgroundColor:`#ffffff`,maxWidth:`600px`,minWidth:`300px`,paddingTop:`0.5rem`,paddingRight:`0.5rem`,paddingBottom:`0.5rem`,paddingLeft:`0.5rem`,borderRadius:`0px`,borderWidth:`0px`,borderColor:`transparent`},body:{backgroundColor:`#ffffff`,paddingTop:`0px`,paddingRight:`0px`,paddingBottom:`0px`,paddingLeft:`0px`},button:{backgroundColor:`#000000`,color:`#ffffff`,paddingTop:`10px`,paddingRight:`32px`,paddingBottom:`10px`,paddingLeft:`32px`},link:{color:T},font:w};var D=class{constructor(e){this.maily=e}render(e){return typeof e==`string`?e:this.renderNode(e)}renderNode(e){let t=e.type||``;switch(t){case`doc`:return this.doc(e);case`paragraph`:return this.paragraph(e);case`text`:return this.text(e);case`variable`:return this.variable(e);default:return``}}doc(e){let t=e.content||[];return t.length===0?``:t.map(e=>this.renderNode(e)).join(``)}paragraph(e){let t=e.content||[];return t.length===0?``:t.map(e=>this.renderNode(e)).join(``)}text(e){return e.text||``}variable(e){let{id:t,fallback:n}=e.attrs||{};return this.maily.getVariableValue(t,n)}};const O={WebkitFontSmoothing:`antialiased`,MozOsxFontSmoothing:`grayscale`},k={h1:{fontSize:`36px`,lineHeight:`40px`,fontWeight:800},h2:{fontSize:`30px`,lineHeight:`36px`,fontWeight:700},h3:{fontSize:`24px`,lineHeight:`38px`,fontWeight:600}},A={sm:`40px`,md:`48px`,lg:`64px`},ee=`SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,j=`#ffffff`,M=`left`,N=1,P=`#000000`,F=0,I=0,L=0,R=0,z=5,B=5,V=5,H=5,te=`100%`,U=8,ne=`transparent`,re=0,ie=0,ae=`transparent`,W=0,G=0,K=0,q=0,J=20,Y=20,X=/https?:\/\//,Z=[{name:`viewport`,content:`width=device-width`},{httpEquiv:`X-UA-Compatible`,content:`IE=edge`},{name:`x-apple-disable-message-reformatting`},{name:`format-detection`,content:`telephone=no,address=no,email=no,date=no,url=no`},{name:`color-scheme`,content:`light`},{name:`supported-color-schemes`,content:`light`}],Q={lang:`en`,dir:`ltr`},oe={pretty:!1,plainText:!1};var $=class{preheader=new D(this);content;config={theme:E};variableFormatter=({variable:e,fallback:t})=>t?`{{${e},fallback=${t}}}`:`{{${e}}}`;shouldReplaceVariableValues=!1;variableValues=new Map;linkValues=new Map;openTrackingPixel;payloadValues=new Map;marksOrder=[`underline`,`bold`,`italic`,`textStyle`,`link`];meta=Z;htmlProps=Q;constructor(e={type:`doc`,content:[]}){this.content=e}setPreviewText(e){this.config.preview=e}setTheme(e){this.config.theme=_(this.config.theme||E,e)}setVariableFormatter(e){this.variableFormatter=e}setVariableValue(e,t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(e,t)}setVariableValues(e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(e).forEach(([e,t])=>{this.setVariableValue(e,t)})}setLinkValue(e,t){this.linkValues.set(e,t)}setLinkValues(e){Object.entries(e).forEach(([e,t])=>{this.setLinkValue(e,t)})}setPayloadValue(e,t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(e,t)}setPayloadValues(e){Object.entries(e).forEach(([e,t])=>{this.setPayloadValue(e,t)})}setOpenTrackingPixel(e){this.openTrackingPixel=e}setShouldReplaceVariableValues(e){this.shouldReplaceVariableValues=e}setMetaTags(e){this.meta.push(...e)}setHtmlProps(e){this.htmlProps={...this.htmlProps,...e}}getAllLinks(){let e=this.content.content||[],t=new Set,n=e=>e&&this.isValidUrl(e)&&!e.startsWith(`#`)&&!e.startsWith(`mailto:`)&&!e.startsWith(`tel:`)&&typeof e==`string`,r=e=>{if(e.type===`button`){let r=e.attrs?.url;n(r)&&r&&t.add(r)}else e.content&&e.content.forEach(e=>{e.marks&&e.marks.forEach(e=>{let r=e.attrs?.href;e.type===`link`&&n(r)&&t.add(r)}),e.content&&r(e)})};return e.forEach(e=>{r(e)}),t}isValidUrl(e){try{let t=new URL(e);return!0}catch(e){return!1}}async render(e=oe){let t=this.markup();return(0,u.renderAsync)(t,e)}children(){let e=this.content.content||[],t=e.map((t,n)=>{let r={prev:e[n-1],next:e[n+1],parent:t},i=this.renderNode(t,r);return i?(0,d.jsx)(c.Fragment,{children:i},b()):null});return t}markup(){let e=this.children(),{preview:t}=this.config,n=x(this.meta),r=this.htmlProps,i=this.config.theme?.container,a={...this.config.theme?.font||w,fontStyle:`normal`,fontWeight:400},o={margin:`0px`,...this.config.theme?.body},s=t?this.preheader.render(t):null,c=(0,d.jsxs)(l.Html,{...r,children:[(0,d.jsxs)(l.Head,{children:[(0,d.jsx)(l.Font,{...a}),(0,d.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}`}}),n]}),(0,d.jsxs)(l.Body,{style:o,children:[s?(0,d.jsx)(l.Preview,{children:s}):null,(0,d.jsx)(l.Container,{style:{width:`100%`,marginLeft:`auto`,marginRight:`auto`,borderStyle:`solid`,...i},children:e}),this.openTrackingPixel?(0,d.jsx)(l.Img,{alt:``,src:this.openTrackingPixel,style:{display:`none`,width:`1px`,height:`1px`}}):null]})]});return c}getMarginOverrideConditions(e,t){let{parent:n,prev:r,next:i}=t||{},a=i?.type===`spacer`,o=r?.type===`spacer`,s=n?.type===`listItem`,c=n?.type===`section`&&!i,l=n?.type===`section`&&!r,u=n?.type===`column`&&!i,d=n?.type===`column`&&!r,f=n?.type===`repeat`&&!r,p=n?.type===`repeat`&&!i,m=n?.type===`show`&&!r,h=n?.type===`show`&&!i;return{isNextSpacer:a,isPrevSpacer:o,isLastSectionElement:c,isFirstSectionElement:l,isParentListItem:s,isLastColumnElement:u,isFirstColumnElement:d,isFirstRepeatElement:f,isLastRepeatElement:p,isFirstShowElement:m,isLastShowElement:h,shouldRemoveTopMargin:o||l||d||f||m,shouldRemoveBottomMargin:a||c||u||p||h}}getMappedContent(e,t){let n=e.content||[];return n.map((e,r)=>{let i=this.renderNode(e,{...t,next:n[r+1],prev:n[r-1]});return i?(0,d.jsx)(c.Fragment,{children:i},b()):null}).filter(e=>e!==null)}renderNode(e,t={}){let n=e.type||``;if(n in this)return this[n]?.(e,t);throw Error(`Node type "${n}" is not supported.`)}renderMark(e,t){let n=e?.text||(0,d.jsx)(d.Fragment,{children:`\xA0`}),r=e?.marks||[];return r.sort((e,t)=>this.marksOrder.indexOf(e.type)-this.marksOrder.indexOf(t.type)),r.reduce((e,t)=>{let n=t.type;if(n in this)return this[n]?.(t,e);throw Error(`Mark type "${n}" is not supported.`)},(0,d.jsx)(d.Fragment,{children:n}))}paragraph(e,t){let{attrs:n}=e,r=n?.textAlign||`left`,{isParentListItem:i,shouldRemoveBottomMargin:a}=this.getMarginOverrideConditions(e,t),o=this.shouldShow(e,t);if(!o)return(0,d.jsx)(d.Fragment,{});let s=i||a?0:20;return(0,d.jsx)(l.Text,{style:{...r===`left`?{}:{textAlign:r},...O,fontSize:this.config.theme?.fontSize?.paragraph?.size,lineHeight:this.config.theme?.fontSize?.paragraph?.lineHeight,color:this.config.theme?.colors?.paragraph,margin:`0 0 ${s}px 0`},children:e.content?this.getMappedContent(e,{...t,parent:e}):(0,d.jsx)(d.Fragment,{children:`\xA0`})})}text(e,t){if(e.marks)return this.renderMark(e,t);let n=e.text,r=n?.match(/\s/g);return r&&r.length===n?.length?(0,d.jsx)(d.Fragment,{children:r.map((e,t)=>(0,d.jsx)(c.Fragment,{children:`\xA0`},t))}):n?(0,d.jsx)(d.Fragment,{children:n}):(0,d.jsx)(d.Fragment,{children:`\xA0`})}bold(e,t){return(0,d.jsx)(`strong`,{children:t})}italic(e,t){return(0,d.jsx)(`em`,{children:t})}underline(e,t){return(0,d.jsx)(`u`,{children:t})}strike(e,t){return(0,d.jsx)(`s`,{style:{textDecoration:`line-through`},children:t})}textStyle(e,t){let{attrs:n}=e,{color:r=this.config.theme?.colors?.paragraph}=n||{};return(0,d.jsx)(`span`,{style:{color:r},children:t})}link(e,t,n){let{attrs:r}=e,i=this.config.theme?.link,a=r?.href||`#`,o=r?.target||`_blank`,s=r?.rel||`noopener noreferrer nofollow`,c=r?.isUrlVariable??!1;if(c){let e=this.removeLinkProtocol(a);a=this.variableUrlValue(e,n)}else a=this.linkValues.get(a)||a;return(0,d.jsx)(l.Link,{href:a,rel:s,style:{fontWeight:500,textDecoration:`none`,color:i?.color||T},target:o,children:t})}removeLinkProtocol(e){return e.replace(X,``)}variableUrlValue(e,t){let{payloadValue:n}=t||{},r=this.removeLinkProtocol(e);return this.shouldReplaceVariableValues?(typeof n==`object`?n[r]:n)??this.variableValues.get(r)??e:this.variableFormatter({variable:r})}heading(e,t){let{attrs:n}=e,r=`h${Number(n?.level)||1}`,i=n?.textAlign||`left`,{shouldRemoveBottomMargin:a}=this.getMarginOverrideConditions(e,t),{fontSize:o,lineHeight:s,fontWeight:c}=k[r],u=this.shouldShow(e,t);return u?(0,d.jsx)(l.Heading,{as:r,style:{textAlign:i,color:this.config.theme?.colors?.heading,fontSize:o,lineHeight:s,fontWeight:c},mb:a?0:12,mt:0,mx:0,children:this.getMappedContent(e,{...t,parent:e})}):(0,d.jsx)(d.Fragment,{})}variable(e,t){let{payloadValue:n}=t||{},{id:r,fallback:i}=e.attrs||{},a=this.shouldShow(e,t);if(!a||!r)return(0,d.jsx)(d.Fragment,{});let o=this.getVariableValue(r,i,t);return e?.marks?this.renderMark({text:o,marks:e.marks},t):(0,d.jsx)(d.Fragment,{children:o})}getVariableValue(e,t,n){let{payloadValue:r}=n||{},i=this.variableFormatter({variable:e,fallback:t});return this.shouldReplaceVariableValues&&(i=(typeof r==`object`?r[e]:r)??this.variableValues.get(e)??t??i),i}horizontalRule(e,t){return(0,d.jsx)(l.Hr,{style:{marginTop:`32px`,marginBottom:`32px`}})}orderedList(e,t){let{shouldRemoveBottomMargin:n}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(l.Container,{style:{marginTop:`0px`,marginBottom:n?`0`:`20px`},children:(0,d.jsx)(`ol`,{style:{paddingLeft:`26px`,listStyleType:`decimal`},children:this.getMappedContent(e,{...t,parent:e})})})}bulletList(e,t){let{parent:n,next:r}=t||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(e,{parent:n,next:r});return(0,d.jsx)(l.Container,{style:{maxWidth:`100%`,marginTop:`0px`,marginBottom:i?`0`:`20px`},children:(0,d.jsx)(`ul`,{style:{paddingLeft:`26px`,listStyleType:`disc`},children:this.getMappedContent(e,{...t,parent:e})})})}listItem(e,t){return(0,d.jsx)(`li`,{style:{marginBottom:`8px`,marginTop:`8px`,paddingLeft:`6px`,...O},children:this.getMappedContent(e,{...t,parent:e})})}button(e,t){let{attrs:n}=e,r=this.config.theme?.button,{text:i,isTextVariable:a,url:o,isUrlVariable:s,variant:c,buttonColor:u,textColor:f,borderRadius:p,alignment:m=`left`,paddingTop:h,paddingRight:g,paddingBottom:_,paddingLeft:v}=n||{},y=u||r?.backgroundColor,b=f||r?.color,x=parseInt(String(h||r?.paddingTop))||0,S=parseInt(String(g||r?.paddingRight))||0,C=parseInt(String(_||r?.paddingBottom))||0,w=parseInt(String(v||r?.paddingLeft))||0,T=this.shouldShow(e,t);if(!T)return(0,d.jsx)(d.Fragment,{});let E=`0px`;p===`round`?E=`9999px`:p===`smooth`&&(E=`6px`);let{shouldRemoveBottomMargin:D}=this.getMarginOverrideConditions(e,t),O=s?this.variableUrlValue(o,t):this.linkValues.get(o)||o,k=a?this.variableUrlValue(i,t):i;return x+=2,C+=2,(0,d.jsx)(l.Container,{style:{textAlign:m,maxWidth:`100%`,marginBottom:D?`0px`:`20px`},children:(0,d.jsx)(l.Button,{href:O,style:{color:String(b),backgroundColor:c===`filled`?String(y):`transparent`,borderColor:String(y),borderWidth:`2px`,borderStyle:`solid`,textDecoration:`none`,fontSize:`14px`,fontWeight:500,borderRadius:E,padding:`${x}px ${S}px ${C}px ${w}px`},children:k})})}spacer(e,t){let{attrs:n}=e,{height:r}=n||{},i=this.shouldShow(e,t);return i?(0,d.jsx)(l.Container,{style:{height:`${r}px`}}):(0,d.jsx)(d.Fragment,{})}hardBreak(e,t){return(0,d.jsx)(`br`,{})}logo(e,t){let{attrs:n}=e,{src:r,isSrcVariable:i,alt:a,title:o,size:s,alignment:c=`left`}=n||{},u=this.shouldShow(e,t);if(!u)return(0,d.jsx)(d.Fragment,{});r=i?this.variableUrlValue(r,t):r;let{shouldRemoveBottomMargin:f}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(l.Row,{style:{marginTop:`0px`,marginBottom:f?`0px`:`32px`},children:(0,d.jsx)(l.Column,{align:c,children:(0,d.jsx)(l.Img,{alt:a||o||`Logo`,src:r,style:{width:A[s]||s,height:A[s]||s},title:o||a||`Logo`})})})}image(e,t){let{attrs:n}=e,{src:r,isSrcVariable:i,alt:a,title:o,width:s=`auto`,height:c=`auto`,alignment:u=`center`,externalLink:f=``,isExternalLinkVariable:p,borderRadius:m=0}=n||{},h=this.shouldShow(e,t);if(!h)return(0,d.jsx)(d.Fragment,{});let{shouldRemoveBottomMargin:g}=this.getMarginOverrideConditions(e,t);r=i?this.variableUrlValue(r,t):r,f=p?this.variableUrlValue(f,t):f;let _=s===`auto`?`auto`:Number(s),v=_===`auto`?`auto`:`${_}px`,y=c===`auto`?`auto`:Number(c),b=y===`auto`?`auto`:`${y}px`,x=(0,d.jsx)(l.Img,{alt:a||o||`Image`,src:r,style:{width:v,height:b,maxWidth:`100%`,outline:`none`,border:`none`,textDecoration:`none`,display:`block`,borderRadius:m},title:o||a||`Image`});return(0,d.jsx)(l.Row,{style:{marginTop:`0px`,marginBottom:g?`0px`:`32px`},children:(0,d.jsx)(l.Column,{align:u,children:f?(0,d.jsx)(`a`,{href:f,rel:`noopener noreferrer`,style:{display:`block`,maxWidth:`100%`,textDecoration:`none`},target:`_blank`,children:x}):x})})}footer(e,t){let{attrs:n}=e,{textAlign:r=`left`}=n||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(l.Text,{style:{fontSize:this.config.theme?.fontSize?.footer?.size,lineHeight:this.config.theme?.fontSize?.footer?.lineHeight,color:this.config.theme?.colors?.footer,marginTop:`0px`,marginBottom:i?`0px`:`20px`,textAlign:r,...O},children:this.getMappedContent(e,{...t,parent:e})})}blockquote(e,t){let{isPrevSpacer:n,shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(e,t);return(0,d.jsx)(`blockquote`,{style:{borderLeftWidth:`4px`,borderLeftStyle:`solid`,borderLeftColor:this.config.theme?.colors?.blockquoteBorder,paddingLeft:`16px`,marginLeft:`0px`,marginRight:`0px`,marginTop:n?`0px`:`20px`,marginBottom:r?`0px`:`20px`},children:this.getMappedContent(e,{...t,parent:e})})}code(e,t){return(0,d.jsx)(`code`,{style:{backgroundColor:this.config.theme?.colors?.codeBackground,color:this.config.theme?.colors?.codeText,padding:`2px 4px`,borderRadius:`6px`,fontFamily:ee,fontWeight:400,letterSpacing:0},children:t})}linkCard(e,t){let{attrs:n}=e,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(e,t),{title:i,description:a,link:o,linkTitle:s,image:c,badgeText:u,subTitle:f}=n||{},p=this.linkValues.get(o)||this.variableValues.get(o)||o||`#`;return(0,d.jsxs)(`a`,{href:p,rel:`noopener noreferrer`,style:{border:`1px solid #eaeaea`,borderRadius:`10px`,textDecoration:`none`,color:`inherit`,display:`block`,marginBottom:r?`0px`:`20px`},target:`_blank`,children:[c?(0,d.jsx)(l.Row,{style:{marginBottom:`6px`},children:(0,d.jsx)(l.Column,{style:{width:`100%`,height:`100%`},children:(0,d.jsx)(l.Img,{alt:i||`Link Card`,src:c,style:{borderRadius:`10px 10px 0 0`,width:`100%`,height:`100%`,objectFit:`cover`},title:i||`Link Card`})})}):null,(0,d.jsx)(l.Row,{style:{padding:`15px`,marginTop:0,marginBottom:0},children:(0,d.jsxs)(l.Column,{style:{verticalAlign:`top`},children:[(0,d.jsxs)(l.Row,{align:void 0,style:{marginBottom:`8px`,marginTop:`0px`},width:`auto`,children:[(0,d.jsx)(l.Column,{children:(0,d.jsx)(l.Text,{style:{fontSize:`18px`,fontWeight:600,color:this.config.theme?.colors?.linkCardTitle,margin:`0px`,...O},children:i})}),u||f?(0,d.jsxs)(l.Column,{style:{paddingLeft:`6px`,verticalAlign:`middle`},children:[u?(0,d.jsx)(`span`,{style:{fontWeight:600,color:this.config.theme?.colors?.linkCardBadgeText,padding:`4px 8px`,borderRadius:`8px`,backgroundColor:this.config.theme?.colors?.linkCardBadgeBackground,fontSize:`12px`,lineHeight:`12px`},children:u}):null,` `,f&&!u?(0,d.jsx)(`span`,{style:{fontWeight:`normal`,color:this.config.theme?.colors?.linkCardSubTitle,fontSize:`12px`,lineHeight:`12px`},children:f}):null]}):null]}),(0,d.jsxs)(l.Text,{style:{fontSize:`16px`,color:this.config.theme?.colors?.linkCardDescription,marginTop:`0px`,marginBottom:`0px`,...O},children:[a,` `,s?(0,d.jsx)(`a`,{href:p,rel:`noopener noreferrer`,style:{color:this.config.theme?.colors?.linkCardTitle,fontSize:`14px`,fontWeight:600,textDecoration:`underline`},children:s}):null]})]})})]})}section(e,t){let{attrs:n}=e,{borderRadius:r=0,backgroundColor:i=j,align:a=M,borderWidth:o=N,borderColor:s=P,marginTop:c=F,marginRight:u=I,marginBottom:f=L,marginLeft:p=R,paddingTop:m=z,paddingRight:h=B,paddingBottom:g=V,paddingLeft:_=H}=n||{},v=this.shouldShow(e,t);return v?(0,d.jsx)(l.Row,{style:{marginTop:c,marginRight:u,marginBottom:f,marginLeft:p},children:(0,d.jsx)(l.Column,{align:a,style:{borderColor:s,borderWidth:o,borderStyle:`solid`,backgroundColor:i,borderRadius:r,paddingTop:m,paddingRight:h,paddingBottom:g,paddingLeft:_},children:this.getMappedContent(e,{...t,parent:e})})}):(0,d.jsx)(d.Fragment,{})}columns(e,t){let{attrs:n}=e,r=this.shouldShow(e,t);if(!r)return(0,d.jsx)(d.Fragment,{});let[i,a]=this.adjustColumnsContent(e);return(0,d.jsx)(l.Row,{width:`${a}%`,style:{margin:0,padding:0,width:`${a}%`},className:`tab-row-full`,children:this.getMappedContent(i,{...t,parent:i})})}adjustColumnsContent(e){let{content:t=[]}=e,n=100,r=t.filter(e=>e.type===`column`&&!!Number(e.attrs?.width||0)),i=t.filter(e=>e.type===`column`&&(e.attrs?.width===`auto`||!e.attrs?.width)),a=r.reduce((e,t)=>e+Number(t.attrs?.width),0),o=n-a,s=Math.round(o/i.length),c=t.filter(e=>e.type===`column`).length,l=e.attrs?.gap??U;return[{...e,content:t.map((e,n)=>{let r=e.type===`column`&&(e.attrs?.width===`auto`||!e.attrs?.width),i=n===0,a=n>0&&n<c-1,o=n===t.length-1,u=0,d=0;if(c<3)u=i?0:l/2,d=o?0:l/2;else{let e=l/2*1.5,t=e/2;u=i?0:a?t:e,d=o?0:a?t:e}return u=Math.round(u*100)/100,d=Math.round(d*100)/100,{...e,attrs:{...e.attrs,width:r?s:e.attrs?.width,isFirstColumn:i,isLastColumn:o,index:n,paddingLeft:u,paddingRight:d}}})},i.length===0?Math.min(n,a):n]}column(e,t){let{attrs:n}=e,{width:r,verticalAlign:i=`top`,paddingLeft:a=0,paddingRight:o=0}=n||{};return(0,d.jsx)(l.Column,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:i},className:`tab-col-full`,children:(0,d.jsx)(l.Section,{style:{margin:0,paddingLeft:a,paddingRight:o},className:`tab-pad`,children:this.getMappedContent(e,{...t,parent:e})})})}repeat(e,t){let{attrs:n}=e,{each:r=``}=n||{},i=this.shouldShow(e,t);if(!i)return(0,d.jsx)(d.Fragment,{});let{payloadValue:a}=t||{};a=typeof a==`object`?a:{};let o=this.payloadValues.get(r)??a[r]??[];if(!Array.isArray(o))throw Error(`Payload value for each "${r}" is not an array`);return(0,d.jsx)(d.Fragment,{children:o.map(n=>(0,d.jsx)(c.Fragment,{children:this.getMappedContent(e,{...t,parent:e,payloadValue:n})},b()))})}for(e,t){return this.repeat(e,t)}shouldShow(e,t){let n=e?.attrs?.showIfKey??``;if(!n)return!0;let{payloadValue:r}=t||{};return r=typeof r==`object`?r:{},!!(this.payloadValues.get(n)??r[n])}htmlCodeBlock(e,t){let n=this.shouldShow(e,t);if(!n)return(0,d.jsx)(d.Fragment,{});let r=e.content?.reduce((e,n)=>{if(n?.type===`text`)return e+n?.text;if(n?.type===`variable`){let r=this.getVariableValue(n?.attrs?.id,n?.attrs?.fallback,t);return e+r}return e},``)||``,i=(0,p.default)(r),a=(0,f.parse)(i),o=a?.querySelector(`head`);o?.remove();let s=a.toString();return(0,d.jsx)(`table`,{align:`left`,width:`100%`,border:0,cellPadding:`0`,cellSpacing:`0`,role:`presentation`,children:(0,d.jsx)(`tbody`,{children:(0,d.jsx)(`tr`,{style:{width:`100%`},children:(0,d.jsx)(`td`,{style:{width:`100%`},dangerouslySetInnerHTML:{__html:s}})})})})}inlineImage(e,t){let{attrs:n}=e,{src:r,isSrcVariable:i,alt:a=``,title:o=``,height:s=J,width:c=Y,externalLink:l=``,isExternalLinkVariable:u}=n||{};r=i?this.variableUrlValue(r,t):r,l=u?this.variableUrlValue(l,t):l;let f=(0,d.jsx)(`img`,{src:r,alt:a,title:o,width:c,height:s,style:{display:`inline`,verticalAlign:`middle`,width:`${c}px`,height:`${s}px`,outline:`none`,border:`none`,textDecoration:`none`}});return l?(0,d.jsx)(`a`,{href:l,rel:`noopener noreferrer`,style:{display:`inline`,textDecoration:`none`},target:`_blank`,children:f}):f}};async function se(e,t){let{theme:n,preview:r,...i}=t||{},a=new $(e);return a.setPreviewText(r),a.setTheme(n||{}),a.render(i)}exports.DEFAULT_COLUMNS_GAP=U,exports.DEFAULT_COLUMNS_WIDTH=te,exports.DEFAULT_COLUMN_BACKGROUND_COLOR=ne,exports.DEFAULT_COLUMN_BORDER_COLOR=ae,exports.DEFAULT_COLUMN_BORDER_RADIUS=re,exports.DEFAULT_COLUMN_BORDER_WIDTH=ie,exports.DEFAULT_COLUMN_PADDING_BOTTOM=K,exports.DEFAULT_COLUMN_PADDING_LEFT=q,exports.DEFAULT_COLUMN_PADDING_RIGHT=G,exports.DEFAULT_COLUMN_PADDING_TOP=W,exports.DEFAULT_HTML_PROPS=Q,exports.DEFAULT_INLINE_IMAGE_HEIGHT=J,exports.DEFAULT_INLINE_IMAGE_WIDTH=Y,exports.DEFAULT_META_TAGS=Z,exports.DEFAULT_SECTION_ALIGN=M,exports.DEFAULT_SECTION_BACKGROUND_COLOR=j,exports.DEFAULT_SECTION_BORDER_COLOR=P,exports.DEFAULT_SECTION_BORDER_WIDTH=N,exports.DEFAULT_SECTION_MARGIN_BOTTOM=L,exports.DEFAULT_SECTION_MARGIN_LEFT=R,exports.DEFAULT_SECTION_MARGIN_RIGHT=I,exports.DEFAULT_SECTION_MARGIN_TOP=F,exports.DEFAULT_SECTION_PADDING_BOTTOM=V,exports.DEFAULT_SECTION_PADDING_LEFT=H,exports.DEFAULT_SECTION_PADDING_RIGHT=B,exports.DEFAULT_SECTION_PADDING_TOP=z,exports.LINK_PROTOCOL_REGEX=X,exports.Maily=$,exports.render=se;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|