@vtex-email/react 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,24 @@
1
- import type { ReactNode } from 'react';
2
- export declare function Email({ children, className }: {
1
+ import type { CSSProperties, ReactNode } from 'react';
2
+ export interface EmailProps {
3
3
  children: ReactNode;
4
4
  className?: string;
5
- }): import("react/jsx-runtime").JSX.Element;
5
+ /** Extra nodes for `<head>` (`<title>`, `<style>`, font `<link>`s). Rendered after the React Email defaults. */
6
+ head?: ReactNode;
7
+ /** Extra attributes for `<html>` (for example `xmlns:o` for Outlook). `lang` defaults to the compiled locale. */
8
+ htmlAttributes?: Readonly<Record<string, string>>;
9
+ /** Inline style for `<body>`. */
10
+ bodyStyle?: CSSProperties;
11
+ /**
12
+ * React Email wraps the body content in a full-width presentation table and moves the body style to its cell.
13
+ * `false` writes a plain `<body>` with `bodyStyle` on it, for migrations that must keep an existing structure.
14
+ */
15
+ bodyTable?: boolean;
16
+ /**
17
+ * Document type declaration. Defaults to React Email's XHTML 1.0 Transitional (standards-like rendering).
18
+ * `null` writes none, which puts browsers and WebKit-based clients in quirks mode; use it only to keep the
19
+ * rendering of a legacy template that shipped without a doctype.
20
+ */
21
+ doctype?: string | null;
22
+ }
23
+ export declare function Email({ children, className, head, htmlAttributes, bodyStyle, bodyTable, doctype }: EmailProps): import("react/jsx-runtime").JSX.Element;
6
24
  //# sourceMappingURL=email.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/adapter/email.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMtC,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAUzF"}
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/adapter/email.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMrD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gHAAgH;IAChH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,iHAAiH;IACjH,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACjD,iCAAiC;IACjC,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,SAAgB,EAAE,OAAO,EAAE,EAAE,UAAU,2CAmBpH"}
@@ -1 +1 @@
1
- {"version":3,"file":"compile-email.d.ts","sourceRoot":"","sources":["../../src/compile/compile-email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAKL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE3F,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,aAAa,CAAC,MAAM,SAAS,CAAC,CAAA;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACzC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,cAAc,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA0CxF"}
1
+ {"version":3,"file":"compile-email.d.ts","sourceRoot":"","sources":["../../src/compile/compile-email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAKL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIrD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE3F,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,aAAa,CAAC,MAAM,SAAS,CAAC,CAAA;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACzC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,cAAc,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA2CxF"}
@@ -15,6 +15,8 @@ export interface Session {
15
15
  nextIndex: number;
16
16
  templateId: string;
17
17
  file?: string;
18
+ /** Doctype requested by the Email adapter. undefined keeps the React Email default; null writes none. */
19
+ doctype?: string | null;
18
20
  }
19
21
  export declare function createSession(input: Omit<Session, 'markers' | 'sites' | 'diagnostics' | 'nextIndex'>): Session;
20
22
  export declare function getSession(): Session;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"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B,UAAU,IAAI,OAAO,CAMpC;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAE/D;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,KAAK,CAGrE;AAED,wBAAgB,SAAS,CACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACxD,MAAM,EAAE,MAAM,GACb,MAAM,CAmBR;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAE5E"}
@@ -3,6 +3,11 @@ import type { ReactNode } from 'react';
3
3
  import { type Session } from '../compile/session';
4
4
  import { type Expression } from './expr';
5
5
  export type AttributeValue = string | Expression | ReadonlyArray<string | Expression>;
6
+ /**
7
+ * Value for a dynamic `href`, `src`, `alt`, or `title` on any element (`<a href={Vtex.attr('href', [...])}>`).
8
+ * Accepts a static string, an expression, or a composite of literals and paths. Static `href`/`src` must be
9
+ * https, mailto, or tel.
10
+ */
6
11
  export declare function attributeToken(name: DynamicAttribute, value: AttributeValue): string;
7
12
  export declare function rejectClassExpression(className: string | Expression | undefined, session: Session): string | undefined;
8
13
  export declare function DynamicLink({ href, title, children, className, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/dsl/attributes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAgB,MAAM,kBAAkB,CAAA;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,OAAO,EAAkC,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjF,OAAO,EAAgB,KAAK,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CAAC,aAAa,CAAA;CAC5B,2CAWA;AAED,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE;IACD,IAAI,EAAE,cAAc,CAAA;IACpB,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;CAChC,2CAWA"}
@@ -4,8 +4,17 @@ export declare function Value({ path }: {
4
4
  }): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
5
5
  export declare function textValue(path: string): ReactElement;
6
6
  export declare function textLiteral(value: string | number | boolean | null): ReactElement;
7
- export declare function Helper({ name, args }: {
7
+ export declare function Helper({ name, args, hash, }: {
8
8
  name: string;
9
9
  args: readonly unknown[];
10
+ hash?: Readonly<Record<string, unknown>>;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ /**
13
+ * VTEX eval: runs `code` on the destination after replacing each `${name}` with the matching `vars` value, and
14
+ * prints the result. Emits `{{#eval "code" name=path}}{{/eval}}`. The result is not escaped, so it may carry markup.
15
+ */
16
+ export declare function Eval({ code, vars }: {
17
+ code: string;
18
+ vars?: Readonly<Record<string, unknown>>;
10
19
  }): import("react/jsx-runtime").JSX.Element;
11
20
  //# sourceMappingURL=values.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/dsl/values.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAOzC,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,8EAE/C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAapD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,YAAY,CAajF;AAED,wBAAgB,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,2CAahF"}
1
+ {"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/dsl/values.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAQzC,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,8EAE/C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAapD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,YAAY,CAajF;AAED,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,IAAI,EACJ,IAAI,GACL,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,SAAS,OAAO,EAAE,CAAA;IACxB,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CACzC,2CAwBA;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,2CAEnG"}
@@ -1,8 +1,8 @@
1
- import { DynamicButton, DynamicImg, DynamicLink } from './attributes';
1
+ import { attributeToken, DynamicButton, DynamicImg, DynamicLink } from './attributes';
2
2
  import { Each, Eq, Group, HasSubStr, If, IfCond, Math, RichShippingData, Unless, With } from './blocks';
3
3
  import { expr } from './expr';
4
4
  import { Trans } from './trans';
5
- import { Helper, Value } from './values';
5
+ import { Eval, Helper, Value } from './values';
6
6
  export declare const Vtex: {
7
7
  Each: typeof Each;
8
8
  If: typeof If;
@@ -16,9 +16,11 @@ export declare const Vtex: {
16
16
  RichShippingData: typeof RichShippingData;
17
17
  Value: typeof Value;
18
18
  Helper: typeof Helper;
19
+ Eval: typeof Eval;
19
20
  Link: typeof DynamicLink;
20
21
  Img: typeof DynamicImg;
21
22
  Button: typeof DynamicButton;
23
+ attr: typeof attributeToken;
22
24
  };
23
- export { Each, Eq, expr, Group, HasSubStr, Helper, If, IfCond, Math, RichShippingData, Trans, Unless, Value, With };
25
+ export { Each, Eq, Eval, expr, Group, HasSubStr, Helper, If, IfCond, Math, RichShippingData, Trans, Unless, Value, With, };
24
26
  //# sourceMappingURL=vtex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vtex.d.ts","sourceRoot":"","sources":["../../src/dsl/vtex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACvG,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAExC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;CAgBhB,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"vtex.d.ts","sourceRoot":"","sources":["../../src/dsl/vtex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACvG,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAE9C,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;CAkBhB,CAAA;AAED,OAAO,EACL,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,MAAM,EACN,EAAE,EACF,MAAM,EACN,IAAI,EACJ,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,KAAK,EACL,IAAI,GACL,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export { Email } from './adapter/email';
1
+ export { Email, type EmailProps } from './adapter/email';
2
2
  export { diagnoseStyles } from './adapter/style-diagnostics';
3
3
  export { compileEmail, type BuildManifest, type CompiledArtifact, type CompileEmailInput, type CompileEmailResult, } from './compile/compile-email';
4
+ export { attributeToken, type AttributeValue } from './dsl/attributes';
4
5
  export { isExpression, type Expression } from './dsl/expr';
5
- export { Each, Eq, expr, Group, HasSubStr, Helper, If, IfCond, Math, RichShippingData, Trans, Unless, Value, Vtex, With, } from './dsl/vtex';
6
+ export { Each, Eq, Eval, expr, Group, HasSubStr, Helper, If, IfCond, Math, RichShippingData, Trans, Unless, Value, Vtex, With, } from './dsl/vtex';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EACL,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EACL,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,KAAK,EACL,SAAS,EACT,MAAM,EACN,EAAE,EACF,MAAM,EACN,IAAI,EACJ,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,GACL,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EACL,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EACL,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,MAAM,EACN,EAAE,EACF,MAAM,EACN,IAAI,EACJ,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,GACL,MAAM,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -64,11 +64,12 @@ function addSite(session, id, site) {
64
64
 
65
65
  // src/adapter/email.tsx
66
66
  import { jsx, jsxs } from "react/jsx-runtime";
67
- function Email({ children, className }) {
67
+ function Email({ children, className, head, htmlAttributes, bodyStyle, bodyTable = true, doctype }) {
68
68
  const session = getSession();
69
- return /* @__PURE__ */ jsx(Html, { lang: session.locale, children: /* @__PURE__ */ jsxs(Tailwind, { config: session.tailwind, children: [
70
- /* @__PURE__ */ jsx(Head, {}),
71
- /* @__PURE__ */ jsx(Body, { className, children })
69
+ if (doctype !== void 0) session.doctype = doctype;
70
+ return /* @__PURE__ */ jsx(Html, { lang: session.locale, ...htmlAttributes, children: /* @__PURE__ */ jsxs(Tailwind, { config: session.tailwind, children: [
71
+ /* @__PURE__ */ jsx(Head, { children: head }),
72
+ bodyTable ? /* @__PURE__ */ jsx(Body, { className, ...bodyStyle ? { style: bodyStyle } : {}, children }) : /* @__PURE__ */ jsx("body", { className, style: bodyStyle, children })
72
73
  ] }) });
73
74
  }
74
75
 
@@ -159,6 +160,7 @@ async function compileEmail(input) {
159
160
  throw error;
160
161
  }
161
162
  if (session.diagnostics.length > 0) return fail(session.diagnostics);
163
+ if (session.doctype !== void 0) html = replaceDoctype(html, session.doctype);
162
164
  return assembleDocument({
163
165
  html,
164
166
  markers: session.markers,
@@ -169,6 +171,11 @@ async function compileEmail(input) {
169
171
  locale: input.locale
170
172
  });
171
173
  }
174
+ var LEADING_DOCTYPE = /^\s*<!DOCTYPE[^>]*>/i;
175
+ function replaceDoctype(html, doctype) {
176
+ const body = html.replace(LEADING_DOCTYPE, "");
177
+ return doctype === null ? body : `${doctype}${body}`;
178
+ }
172
179
  function fail(diagnostics) {
173
180
  return { ok: false, diagnostics };
174
181
  }
@@ -188,6 +195,10 @@ function readAborted(error) {
188
195
  return null;
189
196
  }
190
197
 
198
+ // src/dsl/attributes.tsx
199
+ import { Button as EmailButton, Img as EmailImg, Link as EmailLink } from "@react-email/components";
200
+ import { emitLiteral as emitLiteral2 } from "@vtex-email/core";
201
+
191
202
  // src/dsl/expr.ts
192
203
  var brand = /* @__PURE__ */ Symbol("vtex-email.expression");
193
204
  function isExpression(value) {
@@ -202,10 +213,6 @@ var expr = {
202
213
  }
203
214
  };
204
215
 
205
- // src/dsl/attributes.tsx
206
- import { Button as EmailButton, Img as EmailImg, Link as EmailLink } from "@react-email/components";
207
- import { emitLiteral as emitLiteral2 } from "@vtex-email/core";
208
-
209
216
  // src/dsl/resolve.ts
210
217
  import { emitLiteral, errorDiagnostic as errorDiagnostic4, parentHops, parsePath } from "@vtex-email/core";
211
218
  function dslFailure(session, code, message, extra = {}) {
@@ -423,20 +430,38 @@ function textLiteral(value) {
423
430
  addSite(session, token, { kind: "literal", args: [{ kind: "literal", emitted }] });
424
431
  return /* @__PURE__ */ jsx3("span", { "data-anchor": token, children: "\u200B" });
425
432
  }
426
- function Helper({ name, args }) {
433
+ function Helper({
434
+ name,
435
+ args,
436
+ hash
437
+ }) {
427
438
  const session = getSession();
428
439
  const rendered = args.map((arg) => readArgument(arg, session));
440
+ const named = {};
441
+ for (const [key, value] of Object.entries(hash ?? {})) named[key] = readArgument(value, session);
442
+ const detail = [
443
+ ...rendered.map((arg) => arg.emitted),
444
+ ...Object.entries(named).map(([key, arg]) => `${key}=${arg.emitted}`)
445
+ ].join(" ");
429
446
  const token = addMarker(
430
447
  session,
431
- { kind: "text", path: name, detail: rendered.map((arg) => arg.emitted).join(" ") },
448
+ { kind: "text", path: name, detail },
432
449
  {
433
450
  kind: "text",
434
451
  replacement: ""
435
452
  }
436
453
  );
437
- addSite(session, token, { kind: "helper", helper: name, args: rendered });
454
+ addSite(session, token, {
455
+ kind: "helper",
456
+ helper: name,
457
+ args: rendered,
458
+ ...Object.keys(named).length > 0 ? { hash: named } : {}
459
+ });
438
460
  return /* @__PURE__ */ jsx3("span", { "data-anchor": token, children: "\u200B" });
439
461
  }
462
+ function Eval({ code, vars = {} }) {
463
+ return Helper({ name: "eval", args: [expr.literal(code)], hash: vars });
464
+ }
440
465
 
441
466
  // src/dsl/blocks.tsx
442
467
  import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -627,14 +652,17 @@ var Vtex = {
627
652
  RichShippingData,
628
653
  Value,
629
654
  Helper,
655
+ Eval,
630
656
  Link: DynamicLink,
631
657
  Img: DynamicImg,
632
- Button: DynamicButton
658
+ Button: DynamicButton,
659
+ attr: attributeToken
633
660
  };
634
661
  export {
635
662
  Each,
636
663
  Email,
637
664
  Eq,
665
+ Eval,
638
666
  Group,
639
667
  HasSubStr,
640
668
  Helper,
@@ -647,6 +675,7 @@ export {
647
675
  Value,
648
676
  Vtex,
649
677
  With,
678
+ attributeToken,
650
679
  compileEmail,
651
680
  diagnoseStyles,
652
681
  expr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex-email/react",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/marcelotk15/vtex-react-email.git"
@@ -19,12 +19,12 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@react-email/components": "1.0.12",
22
- "@vtex-email/core": "0.3.0",
22
+ "@vtex-email/core": "0.4.0",
23
23
  "react": "19.3.0",
24
24
  "react-dom": "19.3.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@vtex-email/vtex": "0.3.0",
27
+ "@vtex-email/vtex": "0.4.0",
28
28
  "zod": "4.6.5"
29
29
  }
30
30
  }