@emailens/engine 0.9.3 → 0.9.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.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, I as ImageReport, g as InboxPreview, h as SizeReport, i as TemplateReport, j as DeliverabilityReport } from './types-Duj14jTL.cjs';
2
- export { k as AccessibilityIssue, l as ClientTruncation, m as DeliverabilityCheck, n as DeliverabilityIssue, o as EstimateOptions, p as ExportScope, q as FixType, r as ImageInfo, s as ImageIssue, t as InboxPreviewIssue, u as InputFormat, v as LinkIssue, P as PreviewResult, w as SizeIssue, x as SpamIssue, y as TemplateIssue, z as TokenEstimate, B as TokenEstimateWithWarnings, G as estimateAiFixTokens, H as generateFixPrompt, J as heuristicTokenCount } from './types-Duj14jTL.cjs';
3
- export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-BFwlVmzZ.cjs';
1
+ import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, I as ImageReport, g as InboxPreview, h as SizeReport, i as TemplateReport, j as DeliverabilityReport } from './types-p9e1n-G_.cjs';
2
+ export { k as AccessibilityIssue, l as ClientTruncation, m as DeliverabilityCheck, n as DeliverabilityIssue, o as EstimateOptions, p as ExportScope, q as FixType, r as ImageInfo, s as ImageIssue, t as InboxPreviewIssue, u as InputFormat, v as LinkIssue, P as PreviewResult, w as SizeIssue, x as SpamIssue, y as TemplateIssue, z as TokenEstimate, B as TokenEstimateWithWarnings, G as estimateAiFixTokens, H as generateFixPrompt, J as heuristicTokenCount } from './types-p9e1n-G_.cjs';
3
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-WFdbEleP.cjs';
4
4
 
5
5
  declare const EMAIL_CLIENTS: EmailClient[];
6
6
  declare function getClient(id: string): EmailClient | undefined;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, I as ImageReport, g as InboxPreview, h as SizeReport, i as TemplateReport, j as DeliverabilityReport } from './types-Duj14jTL.js';
2
- export { k as AccessibilityIssue, l as ClientTruncation, m as DeliverabilityCheck, n as DeliverabilityIssue, o as EstimateOptions, p as ExportScope, q as FixType, r as ImageInfo, s as ImageIssue, t as InboxPreviewIssue, u as InputFormat, v as LinkIssue, P as PreviewResult, w as SizeIssue, x as SpamIssue, y as TemplateIssue, z as TokenEstimate, B as TokenEstimateWithWarnings, G as estimateAiFixTokens, H as generateFixPrompt, J as heuristicTokenCount } from './types-Duj14jTL.js';
3
- export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-BENS7LIn.js';
1
+ import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, I as ImageReport, g as InboxPreview, h as SizeReport, i as TemplateReport, j as DeliverabilityReport } from './types-p9e1n-G_.js';
2
+ export { k as AccessibilityIssue, l as ClientTruncation, m as DeliverabilityCheck, n as DeliverabilityIssue, o as EstimateOptions, p as ExportScope, q as FixType, r as ImageInfo, s as ImageIssue, t as InboxPreviewIssue, u as InputFormat, v as LinkIssue, P as PreviewResult, w as SizeIssue, x as SpamIssue, y as TemplateIssue, z as TokenEstimate, B as TokenEstimateWithWarnings, G as estimateAiFixTokens, H as generateFixPrompt, J as heuristicTokenCount } from './types-p9e1n-G_.js';
3
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-CkBByvBK.js';
4
4
 
5
5
  declare const EMAIL_CLIENTS: EmailClient[];
6
6
  declare function getClient(id: string): EmailClient | undefined;
package/dist/index.js CHANGED
@@ -8306,7 +8306,8 @@ function generateFixPrompt(options) {
8306
8306
  scores,
8307
8307
  scope,
8308
8308
  selectedClientId,
8309
- format = "html"
8309
+ format = "html",
8310
+ intent
8310
8311
  } = options;
8311
8312
  const filteredWarnings = scope === "current" && selectedClientId ? warnings.filter((w) => w.client === selectedClientId) : warnings;
8312
8313
  const filteredScores = scope === "current" && selectedClientId ? { [selectedClientId]: scores[selectedClientId] } : scores;
@@ -8329,6 +8330,16 @@ function generateFixPrompt(options) {
8329
8330
  - **Scope:** ${clientLabel}
8330
8331
  - **Issues found:** ${errorCount} error${errorCount !== 1 ? "s" : ""}, ${warnCount} warning${warnCount !== 1 ? "s" : ""}, ${infoCount} info`
8331
8332
  );
8333
+ const trimmedIntent = intent == null ? void 0 : intent.trim();
8334
+ if (trimmedIntent) {
8335
+ sections.push(
8336
+ `## User Intent
8337
+
8338
+ The user described what they want this email to achieve. Honor it where possible, but never at the cost of breaking email-client compatibility:
8339
+
8340
+ ` + trimmedIntent
8341
+ );
8342
+ }
8332
8343
  sections.push(
8333
8344
  `## Original Email Code
8334
8345
 
@@ -8896,13 +8907,17 @@ Href: ${href}`
8896
8907
  });
8897
8908
  return issues;
8898
8909
  }
8899
- var STREET_ADDRESS_PATTERN = /\b\d{1,5}\s+[A-Za-z]+\s+(St(reet)?|Ave(nue)?|Blvd|Boulevard|Dr(ive)?|Rd|Road|Ln|Lane|Way|Ct|Court|Pl(ace)?|Pkwy|Parkway|Cir(cle)?|Terr(ace)?|Loop)\b/i;
8910
+ var STREET_ADDRESS_PATTERN = /\b\d{1,5}[A-Za-z]?\s+[A-Za-z]+\s+(St(reet)?|Ave(nue)?|Blvd|Boulevard|Dr(ive)?|Rd|Road|Ln|Lane|Way|Ct|Court|Pl(ace)?|Pkwy|Parkway|Cir(cle)?|Terr(ace)?|Loop)\b/i;
8911
+ var STREET_TYPE_FIRST_PATTERN = /\b\d{1,5}\s+(rue|chemin|avenue|av|boulevard|bd|impasse|all[ée]e|place|route|quai|cours|via|viale|piazza|strada)\b/i;
8912
+ var STREET_TYPE_LEADING_PATTERN = /\b(calle|avenida|avda|plaza|paseo|carrer|rua|travessa)\s+[A-Za-zÀ-ÿ]+.{0,30}?\d{1,4}\b/i;
8913
+ var STREET_TYPE_SUFFIX_PATTERN = /\b[A-Za-zÀ-ÿ]+(stra(ss|ß)e|straat|weg|gasse|allee|platz|vej|gata|gate)\s+\d{1,4}\b/i;
8900
8914
  var PO_BOX_PATTERN = /\bP\.?\s*O\.?\s*Box\s+\d+/i;
8901
- var ZIP_CODE_PATTERN = /\b\d{5}(-\d{4})?\b/;
8915
+ var ZIP_CODE_PATTERN = /\b(\d{5}(-\d{4})?|[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}|\d{4}\s*[A-Z]{2})\b/i;
8902
8916
  var ADDRESS_CLASS_PATTERN = /address|mailing|postal|footer-address|physical-address/i;
8903
8917
  function checkPhysicalAddress($, text, options) {
8904
8918
  if ((options == null ? void 0 : options.emailType) === "transactional") return null;
8905
- if (STREET_ADDRESS_PATTERN.test(text) && ZIP_CODE_PATTERN.test(text)) return null;
8919
+ const hasStreet = STREET_ADDRESS_PATTERN.test(text) || STREET_TYPE_FIRST_PATTERN.test(text) || STREET_TYPE_LEADING_PATTERN.test(text) || STREET_TYPE_SUFFIX_PATTERN.test(text);
8920
+ if (hasStreet && ZIP_CODE_PATTERN.test(text)) return null;
8906
8921
  if (PO_BOX_PATTERN.test(text) && ZIP_CODE_PATTERN.test(text)) return null;
8907
8922
  let foundByClass = false;
8908
8923
  $("[class]").each((_, el) => {